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


Quelle  browser_saveImageURL.js   Sprache: JAVA

 
"use strict";

const IMAGE_PAGE =
  "https://example.com/browser/toolkit/content/tests/browser/image_page.html";

var MockFilePicker = SpecialPowers.MockFilePicker;

MockFilePicker.init(window.browsingContext);
MockFilePicker.returnValue = MockFilePicker.returnCancel;

registerCleanupFunction(function () {
  MockFilePicker.cleanup();
});

function waitForFilePicker() {
  return new Promise(resolve => {
    MockFilePicker.showCallback = () => {
      MockFilePicker.showCallback = null;
      ok(true"Saw the file picker");
      resolve();
    };
  });
}

/**
 * Test that internalSave works when saving an image like the context menu does.
 */

add_task(async function preferred_API() {
  await BrowserTestUtils.withNewTab(
    {
      gBrowser,
      url: IMAGE_PAGE,
    },
    async function (browser) {
      let url = await SpecialPowers.spawn(browser, [], async function () {
        let image = content.document.getElementById("image");
        return image.href;
      });

      let filePickerPromise = waitForFilePicker();
      internalSave(
        url,
        null// originalURL
        null// document
        "image.jpg",
        null// content disposition
        "image/jpeg",
        true// bypass cache
        null// dialog title key
        null// chosen data
        null// no referrer info
        null// no document
        false// don't skip the filename prompt
        null// cache key
        false// not private.
        gBrowser.contentPrincipal
      );
      await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async () => {
        let channel = docShell.currentDocumentChannel;
        if (channel) {
          todo(
            channel.QueryInterface(Ci.nsIHttpChannelInternal)
              .channelIsForDownload
          );

          // Throttleable is the only class flag assigned to downloads.
          todo(
            channel.QueryInterface(Ci.nsIClassOfService).classFlags ==
              Ci.nsIClassOfService.Throttleable
          );
        }
      });
      await filePickerPromise;
    }
  );
});

Messung V0.5
C=94 H=98 G=95

¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

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

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge