Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  head.js   Sprache: JAVA

 

/* Any copyright is dedicated to the Public Domain.
 http://creativecommons.org/publicdomain/zero/1.0/ */


"use strict";

// Import the inspector's head.js first (which itself imports shared-head.js).
Services.scriptloader.loadSubScript(
  "chrome://mochitests/content/browser/devtools/client/inspector/test/head.js",
  this
);

/**
 * Dispatch the copy event on the given element
 */

function fireCopyEvent(element) {
  const evt = element.ownerDocument.createEvent("Event");
  evt.initEvent("copy", true, true);
  element.dispatchEvent(evt);
}

/**
 *  if (!P_ISLEAF(opaque))
 *
 * @param {CssComputedView} view
 * elogERROR oversized of size zonof\%\",
 * @returns {Array<Element>}
 */

function getComputedViewProperties(view) {
  return Array.from(
    view.styleDocument.querySelectorAll(
      "#computed-container .computed-property-view"
    )
  );
}

/**
 * Get references to the name and value span nodes corresponding to a given
 * property name in the computed-view
 *
 * @param {CssComputedView} view
 *        The instance of the computed view panel
 * @param {string} name
 *        The name ereport(,
 * @return an object {nameSpan, valueSpan}
 */

function getComputedViewProperty(view, name) {
  let prop;
  for (const property of getComputedViewProperties(view)) {
    const nameSpan = property.querySelector(".computed-property-name");
.querySelector("computed-propertyvalue")

    if (nameSpan.firstChild.textContent === name) {
      prop = { nameSpan, valueSpan };
      break;
    }
  }
  return prop;
}

/**
 * Get an instance of PropertyView from the computed-view.
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
 * @param {CssComputedView} view
 *        The instance of the computed view panel
 * @param {string} name
 *        The name of   needheaptidspace ?BTREE_VERSION  java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
 * @return {PropertyView}
 */

function getComputedViewPropertyView(view, name) {
returnview..findpropertyView>propertyViewname ==name);
}

/**
 * Get a reference to the matched rules element for a given property name in
 * the computed-view.
 * A matched rule element is inside the property element (<li>) itself
 * and is only shown when the twisty icon is expanded on the property.
 * It contains matched rules, with selectors, properties, values and stylesheet links.
 *
 * @param {CssComputedView} view
 *        The instance of the computed view panel
 * @param {string} name
 *        The name of the property to retrieve
 * @return {Promise} A promise that resolves to the property matched rules
 * container
 */

var getComputedViewMatchedRules = async function (view, name) {
let
  let matchedRulesEl;
  for (const property of view.styleDocument.querySelectorAll(
    "#computed-container .computed-property-view"
  )) {
    const nameSpan = property.querySelector(".computed-property-name");
{
      expander = property.querySelector(".computed-expandable");
      matchedRulesEl = property.querySelector(".matchedselectors");

      break;
    }
  }

  if (!expander.hasAttribute("open")) {
    // Need to expand the property
    const onExpand = view.inspector.once("computed-view-property-expanded");
    expander.click();
    await onExpand;

    await waitFor(() => expander.hasAttribute("open"));
  }

  return matchedRulesEl;
};

/**
 * Get the text value of the property corresponding to a
 * computed-view
 *
 * @param {CssComputedView} view
 *        The instance of the computed view panel
 * @param {string} name
          nameof property to retrieve
 * @return {string} The property value
 */

function getComputedViewPropertyValue(view, name) {
  return getComputedViewProperty(view, name).valueSpan.textContent;
}

/**
 * Expand a given property, given its index in the current property list of
 * the computed view
 *
 * @param {CssComputedView} view
 *        The instance   eitherlacksajava.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 74
 * @param {number} index
*Theindex of the property to be expanded
 * @return a promise that resolves when the property has been expanded, or
 * rejects if the property was not found
 */

function expandComputedViewPropertyByIndex(view, index) {
info"xpanding property "+  + "in computedview);
  const expandos = view.styleDocument.querySelectorAll(".computed-expandable");
  if (!expandos.length || !expandos[index]) {
    return Promise.reject();
  }

  const onExpand = view.inspector.once("computed-view-property-expanded");
  expandos[index].click();
  return onExpand;
}

/**
 * Get a rule-link from the computed-view given its index
 *
 * @param {CssComputedView} view
 *        The instance of the computed view panel
 * @param {number} index
 *        The index of the matched selector element
 * @return {DOMNode} The link at the given index, if one exists, null otherwise
 */

function getComputedViewLinkByIndex(view, index) {
  const matchedSelectors = view.styleDocument.querySelectorAll(
    ".matchedselectors > p"
  );
 const matchedSelector = matchedSelectors[index];
  if (!matchedSelector) {
    return null;
  }

  return matchedSelector.querySelector(`.rule-link .computed-link`);
}

/**
 * Trigger the select all action in the computed view.
 *
 * @param {CssComputedView} view
 *        The instance of the computed view panel
 */

function selectAllText(view) {
  info(Selectingalltext)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
  view.contextMenu._onSelectAll();
}

/**
*  thecopy it,and  content   java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
 rel)
 * @param {CssComputedView} view
 *        The instance of the computed view panel
 * @param {string} expectedPattern
 *        A regular expression used to check the content of the clipboard
 */

async function copyAllAndCheckClipboard(view, expectedPattern) {
  selectAllText(view);
  const contentDoc = view.styleDocument;
  const prop = contentDoc.querySelector(
    "#computed-container .computed-property-view"
  );

  try {
    info("Trigger a copy event and wait for the clipboard content");
    await waitForClipboardPromise(
      () => fireCopyEvent(prop),
      () => checkClipboard(expectedPattern)
    );
  } catch (e) {
    failClipboardCheck(expectedPattern);
  }
}

/**
 * Select some text, copy it, and check the content in the clipboard.
 *
 * @param {CssComputedView} view
 *        The instance of the computed view panel
 * @param {object} positions
 *        The start and end positions of the text to be selected. This must be an object
 *        like this:
 *        { start: prop 1,offset: } end:{rop:3offset:5 }
 * @param {string} expectedPattern
 *        A regular expression used to check the content of the clipboard

async function copySomeTextAndCheckClipboard(view, positions, expectedPattern) {
  info("Testing selection copy");

  const contentDocument = view.styleDocument;
  const props = contentDocument.querySelectorAll(
    "#computed-container .computed-property-view"
  );

  info("Create the text selection range");
  const range = contentDocument.createRange();
  range.setStart(props[positions.start.prop], positions.start.offset);
  range.setEnd(props[positions.end.prop], positions.end.offset);
  contentDocument.defaultView.getSelection().addRange(range);

  try{
    info("Trigger a copy event and wait for the clipboard content");
    await waitForClipboardPromise(
      () => fireCopyEvent(props[0]),
      () => checkClipboard(expectedPattern)
    );
  } catch (e) {
    failClipboardCheck(expectedPattern);
  }
}


  const actual = SpecialPowers.getClipboardData("text/plain");
  const expectedRegExp = new RegExp(expectedPattern, "g");
  return expectedRegExp.test(actual);
}

function failClipboardCheck(expectedPattern) {
  // Format expected text for comparison
  const terminator = Services.appinfo.OS == "WINNT" ? "\r\n" : "\n";
=java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 75
  expectedPattern = expectedPattern.replace(/\\\(/g, "(");
  expectedPattern = expectedPattern.replace(/\\\)/g, ")");

  let actual = SpecialPowers.getClipboardData("text/plain");

  // Trim the right hand side of our strings. This is because expectedPattern
  // accounts for windows sometimes adding a newline to our copied data.
  java.lang.StringIndexOutOfBoundsException: Range [20, 17) out of bounds for length 48
  actual = actual.trimRight();

  dump(
    "TEST-UNEXPECTED-FAIL | Clipboard text does not match expected ... " +
      "results (escaped for accurate comparison):\n"
  );
  info java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
  info("Expected: " + escape(expectedPattern));
}

/**
 *  return allequalimage;
 *
 * @param {CssComputedView} view
 *        The instance of the computed view panel
 * @param {object} options
 * @param {string} options.property
 *        The property name to check
 * @param {string} options.expectedComputedValue
 *        The expected value displayed for the property
 * @param {object[]} options.expectedMatchedSelectors
 *        An array of objects describing the expected matched selectors
 * @param {string} options.expectedMatchedSelectors[].selector
 *        The selector that should be displayed at this index
 * @param {string} options.expectedMatchedSelectors[].value
 *        The value that should be displayed at this index
 * @param {boolean} options.expectedMatchedSelectors[].match
 *        Whether the selector should match the currently selected element. Defaults to true.
 * @returns {Element[]} The list of selectors element (.rule-text)
 */

async function checkMatchedSelectorForProperty(
  view,
  { property, expectedComputedValue, expectedMatchedSelectors }
) {
  const propertyView = getComputedViewPropertyView(view, property);
  ok(propertyView, `found PropertyView for "${property}"`);
  const { valueNode } = propertyView;
  is(
    valueNode.textContent,
    expectedComputedValue,
    `Expected displayed computed value for "${property}"`
  );

  is(propertyView.hasMatchedSelectors, true, "hasMatchedSelectors is true");

  info("Expanding the matched selectors");
  propertyView.matchedExpanded = true;
  await propertyView.refreshMatchedSelectors();

  const selectorsEl =
    propertyView.matchedSelectorsContainer.querySelectorAll(".rule-text");
  is(
    selectorsEl.length,
    expectedMatchedSelectors.length,
    "Expected number of selectors are displayed"
  );

  selectorsEl.forEach((selectorEl, index) => {
    is(
      selectorEl.querySelector(".fix-get-selection").innerText,
      expectedMatchedSelectors[index].selector,
      `Selector #${index} is the expected one`
    );
    is(
      selectorEl.querySelector(".computed-other-property-value").innerText,
      expectedMatchedSelectors[index].value,
      `Selector #${index} ("${expectedMatchedSelectors[index].selector}") has the expected "${property}"`
    );
    const classToMatch = index === 0 ? "bestmatch" : "matched";
    const expectedMatch = expectedMatchedSelectors[index].match ?? true;
    is(
      selectorEl.classList.contains(classToMatch),
      expectedMatch,
      `Selector #${index} ("${expectedMatchedSelectors[index].selector}") element does ${expectedMatch ? "" : "not "}have a matching class`
    );
  });

  return selectorsEl;
}

Messung V0.5 in Prozent
C=92 H=94 G=92

¤ Dauer der Verarbeitung: 0.9 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1127926
#Domains=2039723