tor-browser

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

bug1911423-app.powerbi.com-emulate-mousewheel-events.js (1188B)


      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 /* globals exportFunction */
      8 
      9 /**
     10 * Bug 1911423 - app.powerbi.com - zooming is broken on maps
     11 *
     12 * They listen for non-standard mousewheel events, rather than wheel,
     13 * which breaks zooming. This emulates mousewheel events for them.
     14 */
     15 
     16 console.info(
     17  "Emulating mousewheel events for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1911423 for details."
     18 );
     19 
     20 (function () {
     21  const { prototype } = window.wrappedJSObject.WheelEvent;
     22  Object.defineProperty(prototype, "type", {
     23    configurable: true,
     24    get: exportFunction(() => "mousewheel", window),
     25    set: exportFunction(() => {}, window),
     26  });
     27 })();
     28 
     29 (function () {
     30  const { prototype } = window.wrappedJSObject.EventTarget;
     31  const { addEventListener } = prototype;
     32  prototype.addEventListener = exportFunction(function (type, fn, c, d) {
     33    if (type === "mousewheel") {
     34      type = "wheel";
     35    }
     36    return addEventListener.call(this, type, fn, c, d);
     37  }, window);
     38 })();