HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //proc/1526/task/1530/cwd/zaklada/html/node_modules/jsdom/lib/jsdom/browser/location.js
"use strict";
const whatwgURL = require("whatwg-url-compat");
const documentBaseURL = require("../living/helpers/document-base-url").documentBaseURL;
const notImplemented = require("./not-implemented");
const URL = whatwgURL.createURLConstructor();

module.exports = Location;

const document = Symbol("relevant document");
const oldParsedURL = Symbol("old parsed URL");

function Location(urlString, relevantDocument) {
  this[document] = relevantDocument;
  whatwgURL.setTheInput(this, urlString);

  try {
    this[oldParsedURL] = new URL(urlString);
  } catch (e) {
    this[oldParsedURL] = {};
  }
}

whatwgURL.mixinURLUtils(
  Location.prototype,
  function getTheBase() {
    return documentBaseURL(this[document]);
  },
  function updateSteps() {
    if (this[oldParsedURL].protocol !== this.protocol ||
        this[oldParsedURL].username !== this.username ||
        this[oldParsedURL].password !== this.password ||
        this[oldParsedURL].hostname !== this.hostname ||
        this[oldParsedURL].port !== this.port ||
        this[oldParsedURL].pathname !== this.pathname ||
        this[oldParsedURL].search !== this.search) {
      notImplemented("navigation via the location interface", this[document]._defaultView);
    } else if (this[oldParsedURL].hash !== this.hash) {
      const window = this[document].defaultView;
      const ev = new window.HashChangeEvent("hashchange", {
        bubbles: true,
        cancelable: false,
        oldURL: this[oldParsedURL].href,
        newURL: this.href
      });

      setTimeout(() => {
        window.dispatchEvent(ev);
      }, 0);
    }

    this[oldParsedURL] = new URL(this.href);
    this[document]._URL = this.href;
  }
);

Location.prototype.assign = function () {
  notImplemented("location.assign", this[document]._defaultView);
};

Location.prototype.replace = function (url) {
  // This is nowhere near spec compliant, but has worked so far.
  whatwgURL.setTheInput(this, url);
};

Location.prototype.reload = function () {
  notImplemented("location.reload", this[document]._defaultView);
};