docs: function wrapRegistrationFunction(object, property, callbackArg) {
          if (typeof object[property] !== "function") {
              console.error("(long-stack-traces) Object", object, "does not contain function", property);
              return;
          }
          if (!has.call(object, property)) {
              console.warn("(long-stack-traces) Object", object, "does not directly contain function", property);
          }
  
          // TODO: better source position detection
          var sourcePosition = (object.constructor.name || Object.prototype.toString.call(object)) + "." + property;
  
          // capture the original registration function
          var fn = object[property];
          // overwrite it with a wrapped registration function that modifies the supplied callback argument
          object[property] = function() {
              // replace the callback argument with a wrapped version that captured the current stack trace
              arguments[callbackArg] = makeWrappedCallback(arguments[callbackArg], sourcePosition);
              // call the original registration function with the modified arguments
              return fn.apply(this, arguments);
          }
  
          // check that the registration function was indeed overwritten
          if (object[property] === fn)
              console.warn("(long-stack-traces) Couldn't replace ", property, "on", object);
      }