Eine aufbereitete Darstellung der Quelle

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

Benutzer

Quelle  test_bug995943.xhtml   Sprache: unbekannt

 
Spracherkennung für: .xhtml vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=995943
-->
<window title="Mozilla Bug 995943"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>

  <!-- test results are displayed in the html:body -->
  <body xmlns="http://www.w3.org/1999/xhtml">
  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=995943"
     target="_blank">Mozilla Bug 995943</a>
  </body>

  <!-- test code goes here -->
  <script type="application/javascript">
  <![CDATA[
  function debug(msg) { info(msg); }

  /** Test for CAPS file:// URI prefs. */
  SimpleTest.waitForExplicitFinish();
  SimpleTest.requestCompleteLog();
  if (navigator.userAgent.includes("Mac OS X 10.10"))
    SimpleTest.expectAssertions(511); // See bug 10670221307988
  else if (Services.appinfo.OS == "WINNT")
    SimpleTest.expectAssertions(01); // See bug 1067022
  else
    SimpleTest.expectAssertions(09); // See bug 13052411145314

  var rootdir = Services.appinfo.OS == "WINNT" ? "file:///C:" : "file:///";

  function checkLoadFileURI(domain, shouldLoad) {
    debug("Invoking checkLoadFileURI with domain: " + domain + ", shouldLoad: " + shouldLoad);
    return new Promise(function(resolve) {
      $('ifr').addEventListener('load', function l1() {
        debug("Invoked l1 for " + domain);
        $('ifr').removeEventListener('load', l1);
        function l2() {
          debug("Invoked l2 for " + domain);
          $('ifr').removeEventListener('load', l2);
          ok(shouldLoad, "Successfully loaded file:// URI for domain: " + domain);
          resolve();
        }
        $('ifr').addEventListener('load', l2);
        try {
          window[0].wrappedJSObject.location = rootdir;
          debug("Successfully navigated for " + domain);
        } catch (e) {
          ok(!shouldLoad && /denied|insecure/.test(e),
             "Prevented loading of file:// URI for domain: " + domain + " - " + e);
          $('ifr').removeEventListener('load', l2);
          resolve();
        }
      });
      let targetURI = domain + '/tests/js/xpconnect/tests/mochitest/file_empty.html';
      debug("Navigating iframe to " + targetURI);
      $('ifr').contentWindow.location = targetURI;
    });
  }

  function pushPrefs(prefs) {
    return SpecialPowers.pushPrefEnv({ set: prefs });
  }

  function popPrefs() {
    return new Promise(function(resolve) { SpecialPowers.popPrefEnv(resolve); });
  }

  var gGoCount = 0;
  function go() {
    debug("Invoking go for window with id: " + window.windowGlobalChild.innerWindowId);
    is(++gGoCount, 1, "Should only call go once!");
    checkLoadFileURI('http://example.com', false).then(
      pushPrefs.bind(null, [['capability.policy.policynames', ' somepolicy '],
                            ['capability.policy.somepolicy.checkloaduri.enabled', 'AlLAcCeSs'],
                            ['capability.policy.somepolicy.sites', 'http://example.com']]))
    .then(checkLoadFileURI.bind(null, 'http://example.com', true))
    .then(popPrefs)
    .then(checkLoadFileURI.bind(null, 'http://example.com', false))
    .then(
      pushPrefs.bind(null, [['capability.policy.policynames', ',somepolicy, someotherpolicy, '],
                            ['capability.policy.somepolicy.checkloaduri.enabled', 'allaccess'],
                            ['capability.policy.someotherpolicy.checkloaduri.enabled', 'nope'],
                            ['capability.policy.somepolicy.sites', ' http://example.org   test1.example.com https://test2.example.com '],
                            ['capability.policy.someotherpolicy.sites', 'http://example.net ']]))
    .then(checkLoadFileURI.bind(null, 'http://example.org', true))
    .then(checkLoadFileURI.bind(null, 'http://test2.example.com', false))
    .then(checkLoadFileURI.bind(null, 'https://test2.example.com', true))
    .then(checkLoadFileURI.bind(null, 'http://sub1.test2.example.com', false))
    .then(checkLoadFileURI.bind(null, 'https://sub1.test2.example.com', true))
    .then(checkLoadFileURI.bind(null, 'http://example.net', false))
    .then(checkLoadFileURI.bind(null, 'http://test1.example.com', true))
    .then(checkLoadFileURI.bind(null, 'https://test1.example.com', true))
    .then(checkLoadFileURI.bind(null, 'http://sub1.test1.example.com', true))
    .then(checkLoadFileURI.bind(null, 'https://sub1.test1.example.com', true))
    .then(pushPrefs.bind(null, [['capability.policy.someotherpolicy.checkloaduri.enabled', 'allAccess']]))
    .then(checkLoadFileURI.bind(null, 'http://example.net', true))
    .then(popPrefs)
    .then(popPrefs)
    .then(checkLoadFileURI.bind(null, 'http://example.net', false))
    .then(SimpleTest.finish.bind(SimpleTest));

  }
  addLoadEvent(go);

  ]]>
  </script>
  <iframe id="ifr" type="content" />
</window>

[Dauer der Verarbeitung: 0.28 Sekunden, vorverarbeitet 2026-06-05]

                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik