forked from mirrors/gecko-dev
The inclusions were removed with the following very crude script and the
resulting breakage was fixed up by hand. The manual fixups did either
revert the changes done by the script, replace a generic header with a more
specific one or replace a header with a forward declaration.
find . -name "*.idl" | grep -v web-platform | grep -v third_party | while read path; do
interfaces=$(grep "^\(class\|interface\).*:.*" "$path" | cut -d' ' -f2)
if [ -n "$interfaces" ]; then
if [[ "$interfaces" == *$'\n'* ]]; then
regexp="\("
for i in $interfaces; do regexp="$regexp$i\|"; done
regexp="${regexp%%\\\|}\)"
else
regexp="$interfaces"
fi
interface=$(basename "$path")
rg -l "#include.*${interface%%.idl}.h" . | while read path2; do
hits=$(grep -v "#include.*${interface%%.idl}.h" "$path2" | grep -c "$regexp" )
if [ $hits -eq 0 ]; then
echo "Removing ${interface} from ${path2}"
grep -v "#include.*${interface%%.idl}.h" "$path2" > "$path2".tmp
mv -f "$path2".tmp "$path2"
fi
done
fi
done
Differential Revision: https://phabricator.services.mozilla.com/D55442
--HG--
extra : moz-landing-system : lando
130 lines
4.1 KiB
C++
130 lines
4.1 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
/* 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/. */
|
|
|
|
#ifndef nsDOMOfflineResourceList_h___
|
|
#define nsDOMOfflineResourceList_h___
|
|
|
|
#include "nscore.h"
|
|
#include "nsIApplicationCache.h"
|
|
#include "nsIApplicationCacheContainer.h"
|
|
#include "nsIApplicationCacheService.h"
|
|
#include "nsIOfflineCacheUpdate.h"
|
|
#include "nsTArray.h"
|
|
#include "nsString.h"
|
|
#include "nsIURI.h"
|
|
#include "nsCOMPtr.h"
|
|
#include "nsWeakReference.h"
|
|
#include "nsCOMArray.h"
|
|
#include "nsIObserver.h"
|
|
#include "nsIScriptContext.h"
|
|
#include "nsCycleCollectionParticipant.h"
|
|
#include "nsPIDOMWindow.h"
|
|
#include "mozilla/DOMEventTargetHelper.h"
|
|
#include "mozilla/ErrorResult.h"
|
|
#include "mozilla/Maybe.h"
|
|
|
|
namespace mozilla {
|
|
namespace dom {
|
|
class DOMStringList;
|
|
class Event;
|
|
} // namespace dom
|
|
} // namespace mozilla
|
|
|
|
class nsDOMOfflineResourceList final : public mozilla::DOMEventTargetHelper,
|
|
public nsIObserver,
|
|
public nsIOfflineCacheUpdateObserver,
|
|
public nsSupportsWeakReference {
|
|
typedef mozilla::ErrorResult ErrorResult;
|
|
|
|
public:
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
NS_DECL_NSIOBSERVER
|
|
NS_DECL_NSIOFFLINECACHEUPDATEOBSERVER
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMOfflineResourceList,
|
|
mozilla::DOMEventTargetHelper)
|
|
|
|
nsDOMOfflineResourceList(nsIURI* aManifestURI, nsIURI* aDocumentURI,
|
|
nsIPrincipal* aLoadingPrincipal,
|
|
nsPIDOMWindowInner* aWindow);
|
|
|
|
void FirePendingEvents();
|
|
void Disconnect();
|
|
|
|
nsresult Init();
|
|
|
|
nsPIDOMWindowInner* GetParentObject() const { return GetOwner(); }
|
|
virtual JSObject* WrapObject(JSContext* aCx,
|
|
JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
uint16_t GetStatus(ErrorResult& aRv);
|
|
|
|
void Update(ErrorResult& aRv);
|
|
|
|
void SwapCache(ErrorResult& aRv);
|
|
|
|
IMPL_EVENT_HANDLER(checking)
|
|
IMPL_EVENT_HANDLER(error)
|
|
IMPL_EVENT_HANDLER(noupdate)
|
|
IMPL_EVENT_HANDLER(downloading)
|
|
IMPL_EVENT_HANDLER(progress)
|
|
IMPL_EVENT_HANDLER(cached)
|
|
IMPL_EVENT_HANDLER(updateready)
|
|
IMPL_EVENT_HANDLER(obsolete)
|
|
|
|
already_AddRefed<mozilla::dom::DOMStringList> GetMozItems(ErrorResult& aRv);
|
|
bool MozHasItem(const nsAString& aURI, ErrorResult& aRv);
|
|
uint32_t GetMozLength(ErrorResult& aRv);
|
|
void MozItem(uint32_t aIndex, nsAString& aURI, ErrorResult& aRv);
|
|
void IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aURI,
|
|
ErrorResult& aRv);
|
|
uint32_t Length() {
|
|
mozilla::IgnoredErrorResult rv;
|
|
uint32_t length = GetMozLength(rv);
|
|
return rv.Failed() ? 0 : length;
|
|
}
|
|
void MozAdd(const nsAString& aURI, ErrorResult& aRv);
|
|
void MozRemove(const nsAString& aURI, ErrorResult& aRv);
|
|
|
|
protected:
|
|
virtual ~nsDOMOfflineResourceList();
|
|
|
|
private:
|
|
void SendEvent(const nsAString& aEventName);
|
|
|
|
void UpdateAdded(nsIOfflineCacheUpdate* aUpdate);
|
|
void UpdateCompleted(nsIOfflineCacheUpdate* aUpdate);
|
|
|
|
already_AddRefed<nsIApplicationCacheContainer> GetDocumentAppCacheContainer();
|
|
already_AddRefed<nsIApplicationCache> GetDocumentAppCache();
|
|
|
|
nsresult GetCacheKey(const nsAString& aURI, nsCString& aKey);
|
|
nsresult GetCacheKey(nsIURI* aURI, nsCString& aKey);
|
|
|
|
nsresult CacheKeys();
|
|
void ClearCachedKeys();
|
|
|
|
bool mInitialized;
|
|
|
|
nsCOMPtr<nsIURI> mManifestURI;
|
|
// AsciiSpec of mManifestURI
|
|
nsCString mManifestSpec;
|
|
|
|
nsCOMPtr<nsIURI> mDocumentURI;
|
|
nsCOMPtr<nsIPrincipal> mLoadingPrincipal;
|
|
nsCOMPtr<nsIApplicationCacheService> mApplicationCacheService;
|
|
nsCOMPtr<nsIApplicationCache> mAvailableApplicationCache;
|
|
nsCOMPtr<nsIOfflineCacheUpdate> mCacheUpdate;
|
|
bool mExposeCacheUpdateStatus;
|
|
uint16_t mStatus;
|
|
|
|
// The set of dynamic keys for this application cache object.
|
|
mozilla::Maybe<nsTArray<nsCString>> mCachedKeys;
|
|
|
|
nsCOMArray<mozilla::dom::Event> mPendingEvents;
|
|
};
|
|
|
|
#endif
|