netwerk/base/nsIPackagedAppService.idl
author B2G Bumper Bot <release+b2gbumper@mozilla.com>
Mon, 22 Feb 2016 03:50:56 -0800
changeset 325570 eb40b8a7a68c57c380ae8b42fcacdcaaff159e0a
parent 291795 0880613d3a905b138a33654b1420a996ee26c1ea
permissions -rw-r--r--
Bumping manifests a=b2g-bump

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

interface nsIChannel;
interface nsICacheEntryOpenCallback;

%{C++
  #define PACKAGED_APP_TOKEN "!//"
%}

/**
 * nsIPackagedAppService
 */
[scriptable, builtinclass, uuid(9c96c638-e80c-4dce-abec-c96fdb7a25d8)]
interface nsIPackagedAppService : nsISupports
{
  /**
   * @param aChannel
   *    this param is passed to the packaged app service in order to provide
   *    info about the requesting channel, which wants to access the contents
   *    of a packaged app resource. Its URI has the following format:
   *          http://domain.com/path/to/package.pak!//path/to/subresource.html
   *
   * @param aCallback
   *    an object implementing nsICacheEntryOpenCallback
   *    this is the target of the async result of the operation
   *    aCallback->OnCacheEntryCheck() is called to verify the entry is valid
   *    aCallback->OnCacheEntryAvailable() is called with a pointer to the
   *    the cached entry, if one exists, or an error code otherwise
   *    aCallback is kept alive using an nsCOMPtr until OnCacheEntryAvailable
   *    is called
   *
   * Calling this method will either download the package containing the given
   * resource URI, store it in the cache and pass the cache entry to aCallback,
   * or if that resource has already been downloaded it will be served from
   * the cache.
   */
  void getResource(in nsIChannel aChannel,
                   in nsICacheEntryOpenCallback aCallback);
};