Commit d98fdd85 authored by Alexandru Marc's avatar Alexandru Marc Committed by amarc@mozilla.com
Browse files

Revert "Bug 1966129 - Teach about:logging to copy the current settings to the...

Revert "Bug 1966129 - Teach about:logging to copy the current settings to the clipboard as a preset URL. r=julienw,desktop-theme-reviewers,emilio" for causing build bustages & lint failures

This reverts commit c0d83d26.
parent 01b72445
Loading
Loading
Loading
Loading

out.js

deleted100644 → 0
+0 −0

Empty file deleted.

+0 −26
Changes for toolkit/content/aboutLogging/aboutLogging.css: 0 added lines, 26 removed lines.
Original line number Diff line number Diff line
@@ -10,32 +10,6 @@
  display: none !important;
}

.about-logging-title-bar {
  display: flex;
  align-items: center;
  gap: 1em;
}

#copy-as-url::part(button) {
  background-image: url("chrome://global/skin/icons/edit-copy.svg");
}

#toast-copied {
  visibility: hidden;
  background-color: var(--background-color-success);
  color: var(--text-color);
  text-align: center;
  border-radius: var(--border-radius-small);
  padding: var(--space-medium);
  opacity: 0;
  transition: opacity 0.5s, visibility 0.5s;
  margin-left: auto;
  &.show {
    visibility: visible;
    opacity: 1;
  }
}

/** Content area **/
.main-content {
  width: min(90%, 1024px);
+0 −18
Changes for toolkit/content/aboutLogging/aboutLogging.html: 0 added lines, 18 removed lines.
Original line number Diff line number Diff line
@@ -27,25 +27,7 @@

  <body id="body">
    <main class="main-content">
      <div class="about-logging-title-bar">
      <h1 id="title" data-l10n-id="about-logging-page-title"></h1>
        <div id="toast-copied" data-l10n-id="about-logging-url-copied"></div>
        <moz-button
          iconsrc="chrome://global/skin/icons/more.svg"
          aria-expanded="false"
          aria-haspopup="menu"
          type="default"
          size="default"
          id="open-menu-button"
        ></moz-button>
        <panel-list>
          <panel-item
            id="copy-as-url"
            data-l10n-id="about-logging-copy-as-url"
            action="copy"
          ></panel-item>
        </panel-list>
      </div>
      <section>
        <div hidden id="error" class="page-subsection info-box">
          <div class="info-box-label" data-l10n-id="about-logging-error"></div>
+0 −64
Changes for toolkit/content/aboutLogging/aboutLogging.mjs: 0 added lines, 64 removed lines.
Original line number Diff line number Diff line
@@ -295,44 +295,6 @@ class ParseError extends Error {
  value;
}

// Returns a URL from the current state of the page
function serializeState() {
  const params = new URLSearchParams();

  const logModules = $("#log-modules")?.value;
  const dropdown = $("#logging-preset-dropdown")?.value;
  const outputType = $("[name=logging-output]:checked")?.value;
  const threads = $("#threads")?.value;
  const profilerPreset = $("#profiler-preset-dropdown")?.value;
  const profilerStacks = $("#with-profiler-stacks-checkbox")?.checked;

  if (logModules && logModules.trim()) {
    params.set("modules", logModules.trim());
  }

  if (dropdown && dropdown !== "custom") {
    params.set("preset", dropdown);
  }

  if (outputType === "profiler" || outputType === "file") {
    params.set("output", outputType);
  }

  if (threads && threads.trim()) {
    params.set("threads", threads.trim());
  }

  if (profilerPreset && profilerPreset !== "none") {
    params.set("profiler-preset", profilerPreset);
  }

  if (profilerStacks) {
    params.set("profilerstacks", "");
  }

  return `about:logging?${params.toString()}`;
}

function parseURL() {
  let options = new URL(document.location.href).searchParams;

@@ -451,16 +413,6 @@ function parseURL() {
  $("#some-elements-unavailable").hidden = !someElementsDisabled;
}

async function copyAsURL() {
  let url = serializeState();
  await navigator.clipboard.writeText(url);
  const toast = $("#toast-copied");
  toast.classList.add("show");
  setTimeout(() => {
    toast.classList.remove("show");
  }, 2000);
}

let gInited = false;
function init() {
  if (gInited) {
@@ -485,22 +437,6 @@ function init() {
  let toggleLoggingButton = $("#toggle-logging-button");
  toggleLoggingButton.addEventListener("click", startStopLogging);

  $("#copy-as-url").onclick = copyAsURL;

  function openMenu(event) {
    if (
      event.type == "mousedown" ||
      event.inputSource == MouseEvent.MOZ_SOURCE_KEYBOARD ||
      !event.detail
    ) {
      document.querySelector("panel-list").toggle(event);
    }
  }

  let menuButton = $("#open-menu-button");
  menuButton.addEventListener("mousedown", openMenu);
  menuButton.addEventListener("click", openMenu);

  $$("input[type=radio]").forEach(radio => {
    radio.onchange = e => {
      updateLoggingOutputType(e.target.value);
+0 −48
Changes for toolkit/content/tests/browser/browser_about_logging.js: 0 added lines, 48 removed lines.
Original line number Diff line number Diff line
@@ -610,51 +610,3 @@ add_task(async function testAndroidUI() {
    );
  });
});

add_task(async function testCopyToClipboard() {
  await BrowserTestUtils.withNewTab(
    PAGE,
    async browser => {
      const document = browser.contentDocument;
      const window = browser.contentWindow;
      // Open the menu, click on the item to copy to the clipboard
      var menuButton = document.querySelector("#open-menu-button");
      EventUtils.synthesizeMouseAtCenter(menuButton, {}, window);
      var copyAction = await getElementFromDocumentByText(
        document,
        "Copy current settings as URL"
      );
      EventUtils.synthesizeMouseAtCenter(copyAction, {}, window);
      // In theory, we could wait for the toast, and check that the clipboard
      // has been filled with reasonnable data. In practice the CI machines
      // are too slow and miss the toast, so we're repeatedly checking the
      // content of the clipboard instead.
      var copiedString = await TestUtils.waitForCondition(() => {
        const xferable = Cc[
          "@mozilla.org/widget/transferable;1"
        ].createInstance(Ci.nsITransferable);
        xferable.init(null);
        xferable.addDataFlavor("text/plain");
        Services.clipboard.getData(xferable, Ci.nsIClipboard.kGlobalClipboard);
        let data = {};
        let type = {};
        try {
          xferable.getAnyTransferData(type, data);
          data = data.value.QueryInterface(Ci.nsISupportsString).data;
        } catch {
          data = "";
        }
        if (data.startsWith("about:logging")) {
          return data;
        }
        return false;
      });
      Assert.stringMatches(
        copiedString,
        /^about:logging\?/,
        `about:logging URL copied successfully ${copiedString}`
      );
    },
    "Waiting to have clipboard data"
  );
});
Loading