Commit 4a06c925 authored by Victor Porof's avatar Victor Porof
Browse files

Bug 1561435 - Format toolkit/components/, a=automatic-formatting

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D36052

--HG--
extra : source : b5be5b4f4b47c256e28a29f665dc754f6407ee7f
parent d3a1b5ae
Loading
Loading
Loading
Loading
+37 −27
Original line number Diff line number Diff line
@@ -23,8 +23,7 @@ const nsISimpleEnumerator = Ci.nsISimpleEnumerator;
 */

function getDirectoryService() {
  return Cc["@mozilla.org/file/directory_service;1"]
           .getService(nsIProperties);
  return Cc["@mozilla.org/file/directory_service;1"].getService(nsIProperties);
}

function nsDefaultCLH() {}
@@ -40,7 +39,7 @@ nsDefaultCLH.prototype = {
  handle: function clh_handle(cmdLine) {
    var printDir;
    while ((printDir = cmdLine.handleFlagWithParam("print-xpcom-dir", false))) {
      var out = "print-xpcom-dir(\"" + printDir + "\"): ";
      var out = 'print-xpcom-dir("' + printDir + '"): ';
      try {
        out += getDirectoryService().get(printDir, nsIFile).path;
      } catch (e) {
@@ -52,12 +51,17 @@ nsDefaultCLH.prototype = {
    }

    var printDirList;
    while ((printDirList = cmdLine.handleFlagWithParam("print-xpcom-dirlist",
                                                       false))) {
      out = "print-xpcom-dirlist(\"" + printDirList + "\"): ";
    while (
      (printDirList = cmdLine.handleFlagWithParam("print-xpcom-dirlist", false))
    ) {
      out = 'print-xpcom-dirlist("' + printDirList + '"): ';
      try {
        for (let file of getDirectoryService().get(printDirList, nsISimpleEnumerator))
        for (let file of getDirectoryService().get(
          printDirList,
          nsISimpleEnumerator
        )) {
          out += file.path + ";";
        }
      } catch (e) {
        out += "<Not Provided>";
      }
@@ -70,15 +74,18 @@ nsDefaultCLH.prototype = {
      cmdLine.preventDefault = true;
    }

    if (cmdLine.preventDefault)
    if (cmdLine.preventDefault) {
      return;
    }

    var prefs = Cc["@mozilla.org/preferences-service;1"]
                  .getService(nsIPrefBranch);
    var prefs = Cc["@mozilla.org/preferences-service;1"].getService(
      nsIPrefBranch
    );

    try {
      var singletonWindowType =
                              prefs.getCharPref("toolkit.singletonWindowType");
      var singletonWindowType = prefs.getCharPref(
        "toolkit.singletonWindowType"
      );

      var win = Services.wm.getMostRecentWindow(singletonWindowType);
      if (win) {
@@ -92,12 +99,15 @@ nsDefaultCLH.prototype = {
    try {
      var chromeURI = prefs.getCharPref("toolkit.defaultChromeURI");

      var flags = prefs.getCharPref("toolkit.defaultChromeFeatures", "chrome,dialog=no,all");
      var flags = prefs.getCharPref(
        "toolkit.defaultChromeFeatures",
        "chrome,dialog=no,all"
      );

      var wwatch = Cc["@mozilla.org/embedcomp/window-watcher;1"]
                            .getService(nsIWindowWatcher);
      wwatch.openWindow(null, chromeURI, "_blank",
                        flags, cmdLine);
      var wwatch = Cc["@mozilla.org/embedcomp/window-watcher;1"].getService(
        nsIWindowWatcher
      );
      wwatch.openWindow(null, chromeURI, "_blank", flags, cmdLine);
    } catch (e) {}
  },

+25 −12
Original line number Diff line number Diff line
@@ -10,30 +10,43 @@ var storage = searchParams.get("storage") || "";
var cacheContext = searchParams.get("context");

// The context is in a format as used by the HTTP cache v2 back end
if (cacheContext)
  var [context, isAnon, isInBrowser, isPrivate] = cacheContext.match(/(a,)?(b,)?(p,)?/);
if (cacheContext) {
  var [context, isAnon, isInBrowser, isPrivate] = cacheContext.match(
    /(a,)?(b,)?(p,)?/
  );
}

function $(id) { return document.getElementById(id) || {}; }
function $(id) {
  return document.getElementById(id) || {};
}

// Initialize the context UI controls at the start according what we got in the "context=" argument
addEventListener("DOMContentLoaded", function() {
addEventListener(
  "DOMContentLoaded",
  function() {
    $("anon").checked = !!isAnon;
    $("inbrowser").checked = !!isInBrowser;
    $("priv").checked = !!isPrivate;
}, false);
  },
  false
);

// When user presses the [Update] button, we build a new context key according the UI control
// values and navigate to a new about:cache?storage=<name>&context=<key> URL.
function navigate() {
  context = "";
  if ($("anon").checked)
  if ($("anon").checked) {
    context += "a,";
  if ($("inbrowser").checked)
  }
  if ($("inbrowser").checked) {
    context += "b,";
  if ($("priv").checked)
  }
  if ($("priv").checked) {
    context += "p,";
  }

  window.location.href = "about:cache?storage=" + storage + "&context=" + context;
  window.location.href =
    "about:cache?storage=" + storage + "&context=" + context;
}

let submitButton = document.getElementById("submit");
+189 −165
Original line number Diff line number Diff line
@@ -14,10 +14,17 @@ function onLoad() {
  updateEnabled();
  reports = service.getReports();
  for (let i = 0; i < reports.length; i++) {
    let text = "Severity " + reports[i].severity + " at " + new Date(reports[i].timestamp).toString();
    let text =
      "Severity " +
      reports[i].severity +
      " at " +
      new Date(reports[i].timestamp).toString();
    let link = document.createElement("a");
    link.href = "#";
    link.addEventListener("click", function() { showReport(i); return false; });
    link.addEventListener("click", function() {
      showReport(i);
      return false;
    });
    link.textContent = text;
    let bullet = document.createElement("li");
    bullet.appendChild(link);
@@ -104,7 +111,7 @@ function loadData() {
    var tokens = lines[i].split(/\s+/);
    var j = 0;
    // skip tokens until RENDERTRACE
        while (j < tokens.length && tokens[j++] != "RENDERTRACE"); // empty loop body
    while (j < tokens.length && tokens[j++] != "RENDERTRACE") {} // empty loop body
    if (j >= tokens.length - 2) {
      log("Error parsing line: " + lines[i]);
      continue;
@@ -141,7 +148,10 @@ function loadData() {
        rect.y = parseFloat(tokens[j++]);
        rect.width = parseFloat(tokens[j++]);
        rect.height = parseFloat(tokens[j++]);
                rect.dataText = trace.value.substring(charPos, charPos + lines[i].length);
        rect.dataText = trace.value.substring(
          charPos,
          charPos + lines[i].length
        );

        if (!getFlag("excludePageFromZoom") || color != "brown") {
          if (typeof minX == "undefined") {
@@ -194,14 +204,16 @@ function renderFrame() {
  var cmy = canvas.height / 2.0;

  // scale factor
    var scale = CANVAS_USE_RATIO * Math.min(canvas.width / (maxX - minX), canvas.height / (maxY - minY));
  var scale =
    CANVAS_USE_RATIO *
    Math.min(canvas.width / (maxX - minX), canvas.height / (maxY - minY));

  function projectX(value) {
        return cmx + ((value - midX) * scale);
    return cmx + (value - midX) * scale;
  }

  function projectY(value) {
        return cmy + ((value - midY) * scale);
    return cmy + (value - midY) * scale;
  }

  function drawRect(color, rect) {
@@ -210,7 +222,8 @@ function renderFrame() {
      projectX(rect.x),
      projectY(rect.y),
      rect.width * scale,
            rect.height * scale);
      rect.height * scale
    );
  }

  // clear canvas
@@ -224,7 +237,11 @@ function renderFrame() {
  }
  // draw timestamp and frame counter
  context.fillStyle = "black";
    context.fillText((frame + 1) + "/" + renderData.length + ": " + renderData[frame].timestamp, 5, 15);
  context.fillText(
    frame + 1 + "/" + renderData.length + ": " + renderData[frame].timestamp,
    5,
    15
  );

  document.getElementById("active").textContent = activeData;

@@ -234,7 +251,7 @@ function renderFrame() {
// -- Player controls --

function reset(beginning) {
    currentFrame = (beginning ? 0 : renderData.length - 1);
  currentFrame = beginning ? 0 : renderData.length - 1;
  renderFrame();
}

@@ -242,9 +259,9 @@ function step(backwards) {
  if (playing) {
    togglePlay();
  }
    currentFrame += (backwards ? -1 : 1);
  currentFrame += backwards ? -1 : 1;
  if (!renderFrame()) {
        currentFrame -= (backwards ? -1 : 1);
    currentFrame -= backwards ? -1 : 1;
  }
}

@@ -278,10 +295,18 @@ function stopPlay() {

document.getElementById("pauseButton").addEventListener("click", togglePlay);
document.getElementById("stopButton").addEventListener("click", stopPlay);
document.getElementById("enableToggleButton").addEventListener("click", toggleEnabled);
document.getElementById("flushReportsButton").addEventListener("click", flushReports);
document.getElementById("excludePageFromZoom").addEventListener("click", loadData);
document.getElementById("stepForwardButton").addEventListener("click", function() {
document
  .getElementById("enableToggleButton")
  .addEventListener("click", toggleEnabled);
document
  .getElementById("flushReportsButton")
  .addEventListener("click", flushReports);
document
  .getElementById("excludePageFromZoom")
  .addEventListener("click", loadData);
document
  .getElementById("stepForwardButton")
  .addEventListener("click", function() {
    step(false);
  });
document.getElementById("forwardButton").addEventListener("click", function() {
@@ -294,4 +319,3 @@ document.getElementById("stepBackButton").addEventListener("click", function() {
  step(true);
});
window.addEventListener("load", onLoad);
+605 −313

File changed.

Preview size limit exceeded, changes collapsed.

+13 −11
Original line number Diff line number Diff line
@@ -3,10 +3,10 @@
"use strict";

function run_test() {
  let gfxInfo = Cc["@mozilla.org/gfx/info;1"].
                getService(Ci.nsIGfxInfo);
  let mgr = Cc["@mozilla.org/memory-reporter-manager;1"].
            getService(Ci.nsIMemoryReporterManager);
  let gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo);
  let mgr = Cc["@mozilla.org/memory-reporter-manager;1"].getService(
    Ci.nsIMemoryReporterManager
  );

  let ok = gfxInfo.controlGPUProcessForXPCShell(true);
  Assert.equal(ok, true);
@@ -17,7 +17,14 @@ function run_test() {
  };

  let foundGPUProcess = false;
  let onHandleReport = function(aProcess, aPath, aKind, aUnits, aAmount, aDescription) {
  let onHandleReport = function(
    aProcess,
    aPath,
    aKind,
    aUnits,
    aAmount,
    aDescription
  ) {
    if (/GPU \(pid \d+\)/.test(aProcess)) {
      foundGPUProcess = true;
    }
@@ -27,11 +34,6 @@ function run_test() {
    endTesting();
  };

  mgr.getReports(
    onHandleReport,
    null,
    onFinishReporting,
    null,
    false);
  mgr.getReports(onHandleReport, null, onFinishReporting, null, false);
  do_test_pending();
}
Loading