Bug 1265767 - Subset of Blink FileSystem API - patch 1 - WebIDL, r=smaug
This commit is contained in:
37
dom/filesystem/compat/DOMFileSystem.cpp
Normal file
37
dom/filesystem/compat/DOMFileSystem.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
/* -*- 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/. */
|
||||
|
||||
#include "DOMFileSystem.h"
|
||||
#include "mozilla/dom/DOMFileSystemBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DOMFileSystem, mParent)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMFileSystem)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMFileSystem)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMFileSystem)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
DOMFileSystem::DOMFileSystem(nsIGlobalObject* aGlobal)
|
||||
: mParent(aGlobal)
|
||||
{}
|
||||
|
||||
DOMFileSystem::~DOMFileSystem()
|
||||
{}
|
||||
|
||||
JSObject*
|
||||
DOMFileSystem::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
return DOMFileSystemBinding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
} // dom namespace
|
||||
} // mozilla namespace
|
||||
64
dom/filesystem/compat/DOMFileSystem.h
Normal file
64
dom/filesystem/compat/DOMFileSystem.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/* -*- 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 mozilla_dom_DOMFileSystem_h
|
||||
#define mozilla_dom_DOMFileSystem_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
class nsIGlobalObject;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class DirectoryEntry;
|
||||
|
||||
class DOMFileSystem final
|
||||
: public nsISupports
|
||||
, public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMFileSystem)
|
||||
|
||||
explicit DOMFileSystem(nsIGlobalObject* aGlobalObject);
|
||||
|
||||
nsIGlobalObject*
|
||||
GetParentObject() const
|
||||
{
|
||||
return mParent;
|
||||
}
|
||||
|
||||
virtual JSObject*
|
||||
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
void
|
||||
GetName(nsAString& aName, ErrorResult& aRv) const
|
||||
{
|
||||
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
already_AddRefed<DirectoryEntry>
|
||||
GetRoot(ErrorResult& aRv) const
|
||||
{
|
||||
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
~DOMFileSystem();
|
||||
|
||||
nsCOMPtr<nsIGlobalObject> mParent;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_DOMFileSystem_h
|
||||
26
dom/filesystem/compat/DirectoryEntry.cpp
Normal file
26
dom/filesystem/compat/DirectoryEntry.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/* -*- 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/. */
|
||||
|
||||
#include "DirectoryEntry.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
DirectoryEntry::DirectoryEntry(nsIGlobalObject* aGlobal)
|
||||
: Entry(aGlobal)
|
||||
{}
|
||||
|
||||
DirectoryEntry::~DirectoryEntry()
|
||||
{}
|
||||
|
||||
JSObject*
|
||||
DirectoryEntry::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
return DirectoryEntryBinding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
} // dom namespace
|
||||
} // mozilla namespace
|
||||
64
dom/filesystem/compat/DirectoryEntry.h
Normal file
64
dom/filesystem/compat/DirectoryEntry.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/* -*- 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 mozilla_dom_DirectoryEntry_h
|
||||
#define mozilla_dom_DirectoryEntry_h
|
||||
|
||||
#include "mozilla/dom/Entry.h"
|
||||
#include "mozilla/dom/DOMFileSystemBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class DirectoryEntry final : public Entry
|
||||
{
|
||||
public:
|
||||
explicit DirectoryEntry(nsIGlobalObject* aGlobalObject);
|
||||
|
||||
virtual JSObject*
|
||||
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
already_AddRefed<DirectoryReader>
|
||||
CreateReader(ErrorResult& aRv) const
|
||||
{
|
||||
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
GetFile(const nsAString& aPath, const FileSystemFlags& aFlag,
|
||||
const Optional<OwningNonNull<EntryCallback>>& aSuccessCallback,
|
||||
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
||||
ErrorResult& aRv) const
|
||||
{
|
||||
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
void
|
||||
GetDirectory(const nsAString& aPath, const FileSystemFlags& aFlag,
|
||||
const Optional<OwningNonNull<EntryCallback>>& aSuccessCallback,
|
||||
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
||||
ErrorResult& aRv) const
|
||||
{
|
||||
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
void
|
||||
RemoveRecursively(VoidCallback& aSuccessCallback,
|
||||
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
||||
ErrorResult& aRv) const
|
||||
{
|
||||
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
private:
|
||||
~DirectoryEntry();
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_DirectoryEntry_h
|
||||
37
dom/filesystem/compat/DirectoryReader.cpp
Normal file
37
dom/filesystem/compat/DirectoryReader.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
/* -*- 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/. */
|
||||
|
||||
#include "DirectoryReader.h"
|
||||
#include "nsIGlobalObject.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DirectoryReader, mParent)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(DirectoryReader)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(DirectoryReader)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DirectoryReader)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
DirectoryReader::DirectoryReader(nsIGlobalObject* aGlobal)
|
||||
: mParent(aGlobal)
|
||||
{}
|
||||
|
||||
DirectoryReader::~DirectoryReader()
|
||||
{}
|
||||
|
||||
JSObject*
|
||||
DirectoryReader::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
return DirectoryReaderBinding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
} // dom namespace
|
||||
} // mozilla namespace
|
||||
57
dom/filesystem/compat/DirectoryReader.h
Normal file
57
dom/filesystem/compat/DirectoryReader.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/* -*- 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 mozilla_dom_DirectoryReader_h
|
||||
#define mozilla_dom_DirectoryReader_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
class nsIGlobalObject;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class DirectoryReader final
|
||||
: public nsISupports
|
||||
, public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DirectoryReader)
|
||||
|
||||
explicit DirectoryReader(nsIGlobalObject* aGlobalObject);
|
||||
|
||||
nsIGlobalObject*
|
||||
GetParentObject() const
|
||||
{
|
||||
return mParent;
|
||||
}
|
||||
|
||||
virtual JSObject*
|
||||
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
void
|
||||
ReadEntries(EntriesCallback& aSuccessCallback,
|
||||
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
||||
ErrorResult& aRv) const
|
||||
{
|
||||
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
private:
|
||||
~DirectoryReader();
|
||||
|
||||
nsCOMPtr<nsIGlobalObject> mParent;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_DirectoryReader_h
|
||||
36
dom/filesystem/compat/Entry.cpp
Normal file
36
dom/filesystem/compat/Entry.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
/* -*- 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/. */
|
||||
|
||||
#include "Entry.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Entry, mParent)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(Entry)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(Entry)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Entry)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
Entry::Entry(nsIGlobalObject* aGlobal)
|
||||
: mParent(aGlobal)
|
||||
{}
|
||||
|
||||
Entry::~Entry()
|
||||
{}
|
||||
|
||||
JSObject*
|
||||
Entry::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
return EntryBinding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
} // dom namespace
|
||||
} // mozilla namespace
|
||||
83
dom/filesystem/compat/Entry.h
Normal file
83
dom/filesystem/compat/Entry.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/* -*- 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 mozilla_dom_Entry_h
|
||||
#define mozilla_dom_Entry_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class DOMFileSystem;
|
||||
|
||||
class Entry
|
||||
: public nsISupports
|
||||
, public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Entry)
|
||||
|
||||
explicit Entry(nsIGlobalObject* aGlobalObject);
|
||||
|
||||
nsIGlobalObject*
|
||||
GetParentObject() const
|
||||
{
|
||||
return mParent;
|
||||
}
|
||||
|
||||
virtual JSObject*
|
||||
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
bool
|
||||
GetIsFile(ErrorResult& aRv) const
|
||||
{
|
||||
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
GetIsDirectory(ErrorResult& aRv) const
|
||||
{
|
||||
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
GetName(nsAString& aName, ErrorResult& aRv) const
|
||||
{
|
||||
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
void
|
||||
GetFullPath(nsAString& aFullPath, ErrorResult& aRv) const
|
||||
{
|
||||
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
DOMFileSystem*
|
||||
GetFilesystem(ErrorResult& aRv) const
|
||||
{
|
||||
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~Entry();
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIGlobalObject> mParent;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_Entry_h
|
||||
26
dom/filesystem/compat/FileEntry.cpp
Normal file
26
dom/filesystem/compat/FileEntry.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/* -*- 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/. */
|
||||
|
||||
#include "FileEntry.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
FileEntry::FileEntry(nsIGlobalObject* aGlobal)
|
||||
: Entry(aGlobal)
|
||||
{}
|
||||
|
||||
FileEntry::~FileEntry()
|
||||
{}
|
||||
|
||||
JSObject*
|
||||
FileEntry::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
return FileEntryBinding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
} // dom namespace
|
||||
} // mozilla namespace
|
||||
50
dom/filesystem/compat/FileEntry.h
Normal file
50
dom/filesystem/compat/FileEntry.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/* -*- 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 mozilla_dom_FileEntry_h
|
||||
#define mozilla_dom_FileEntry_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class FileEntry final : public Entry
|
||||
{
|
||||
public:
|
||||
explicit FileEntry(nsIGlobalObject* aGlobalObject);
|
||||
|
||||
virtual JSObject*
|
||||
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
void
|
||||
CreateWriter(VoidCallback& aSuccessCallback,
|
||||
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
||||
ErrorResult& aRv) const
|
||||
{
|
||||
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
void
|
||||
File(BlobCallback& aSuccessCallback,
|
||||
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
||||
ErrorResult& aRv) const
|
||||
{
|
||||
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
private:
|
||||
~FileEntry();
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_FileEntry_h
|
||||
25
dom/filesystem/compat/moz.build
Normal file
25
dom/filesystem/compat/moz.build
Normal file
@@ -0,0 +1,25 @@
|
||||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
'DirectoryEntry.h',
|
||||
'DirectoryReader.h',
|
||||
'DOMFileSystem.h',
|
||||
'Entry.h',
|
||||
'FileEntry.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'DirectoryEntry.cpp',
|
||||
'DirectoryReader.cpp',
|
||||
'DOMFileSystem.cpp',
|
||||
'Entry.cpp',
|
||||
'FileEntry.cpp',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
@@ -4,6 +4,8 @@
|
||||
# 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/.
|
||||
|
||||
DIRS += ['compat']
|
||||
|
||||
TEST_DIRS += ['tests']
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace dom {
|
||||
class AfterSetFilesOrDirectoriesRunnable;
|
||||
class Date;
|
||||
class DispatchChangeEventCallback;
|
||||
class Entry;
|
||||
class File;
|
||||
class FileList;
|
||||
class GetFilesHelper;
|
||||
@@ -715,6 +716,11 @@ public:
|
||||
SetHTMLBoolAttr(nsGkAtoms::webkitdirectory, aValue, aRv);
|
||||
}
|
||||
|
||||
void GetWebkitEntries(nsTArray<RefPtr<Entry>>& aSequence, ErrorResult& aRv)
|
||||
{
|
||||
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
bool IsFilesAndDirectoriesSupported() const;
|
||||
|
||||
already_AddRefed<Promise> GetFilesAndDirectories(ErrorResult& aRv);
|
||||
|
||||
99
dom/webidl/DOMFileSystem.webidl
Normal file
99
dom/webidl/DOMFileSystem.webidl
Normal file
@@ -0,0 +1,99 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/.
|
||||
*/
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface Entry {
|
||||
[GetterThrows]
|
||||
readonly attribute boolean isFile;
|
||||
|
||||
[GetterThrows]
|
||||
readonly attribute boolean isDirectory;
|
||||
|
||||
[GetterThrows]
|
||||
readonly attribute DOMString name;
|
||||
|
||||
[GetterThrows]
|
||||
readonly attribute DOMString fullPath;
|
||||
|
||||
[GetterThrows]
|
||||
readonly attribute DOMFileSystem filesystem;
|
||||
|
||||
/** Not implemented:
|
||||
* void getMetadata(MetadataCallback successCallback, optional ErrorCallback errorCallback);
|
||||
* void moveTo(DirectoryEntry parent, optional DOMString? name, optional EntryCallback successCallback, optional ErrorCallback errorCallback);
|
||||
* void copyTo(DirectoryEntry parent, optional DOMString? name, optional EntryCallback successCallback, optional ErrorCallback errorCallback);
|
||||
* DOMString toURL();
|
||||
* void remove(VoidCallback successCallback, optional ErrorCallback errorCallback);
|
||||
* void getParent(optional EntryCallback successCallback, optional ErrorCallback errorCallback);
|
||||
*/
|
||||
};
|
||||
|
||||
dictionary FileSystemFlags {
|
||||
boolean create = false;
|
||||
boolean exclusive = false;
|
||||
};
|
||||
|
||||
callback interface EntryCallback {
|
||||
void handleEvent(Entry entry);
|
||||
};
|
||||
|
||||
callback interface VoidCallback {
|
||||
void handleEvent();
|
||||
};
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface DirectoryEntry : Entry {
|
||||
[Throws]
|
||||
DirectoryReader createReader();
|
||||
|
||||
[Throws]
|
||||
void getFile(DOMString? path, optional FileSystemFlags options, optional EntryCallback successCallback, optional ErrorCallback errorCallback);
|
||||
|
||||
[Throws]
|
||||
void getDirectory(DOMString? path, optional FileSystemFlags options, optional EntryCallback successCallback, optional ErrorCallback errorCallback);
|
||||
|
||||
[Throws]
|
||||
void removeRecursively(VoidCallback successCallback, optional ErrorCallback errorCallback);
|
||||
};
|
||||
|
||||
callback interface EntriesCallback {
|
||||
void handleEvent(sequence<Entry> entries);
|
||||
};
|
||||
|
||||
callback interface ErrorCallback {
|
||||
// This should be FileError but we are implementing just a subset of this API.
|
||||
void handleEvent(DOMError error);
|
||||
};
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface DirectoryReader {
|
||||
[Throws]
|
||||
void readEntries (EntriesCallback successCallback, optional ErrorCallback errorCallback);
|
||||
};
|
||||
|
||||
callback interface BlobCallback {
|
||||
void handleEvent(Blob? blob);
|
||||
};
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface FileEntry : Entry {
|
||||
// the successCallback should be a FileWriteCallback but this method is not
|
||||
// implemented.
|
||||
[Throws]
|
||||
void createWriter (VoidCallback successCallback, optional ErrorCallback errorCallback);
|
||||
|
||||
[Throws]
|
||||
void file (BlobCallback successCallback, optional ErrorCallback errorCallback);
|
||||
};
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface DOMFileSystem {
|
||||
[GetterThrows]
|
||||
readonly attribute DOMString name;
|
||||
|
||||
[GetterThrows]
|
||||
readonly attribute DirectoryEntry root;
|
||||
};
|
||||
@@ -209,9 +209,6 @@ partial interface HTMLInputElement {
|
||||
|
||||
[Throws, Pref="dom.input.dirpicker"]
|
||||
void chooseDirectory();
|
||||
|
||||
[Pref="dom.webkitBlink.dirPicker.enabled", BinaryName="WebkitDirectoryAttr", SetterThrows]
|
||||
attribute boolean webkitdirectory;
|
||||
};
|
||||
|
||||
[NoInterfaceObject]
|
||||
@@ -222,3 +219,12 @@ interface MozPhonetic {
|
||||
|
||||
HTMLInputElement implements MozImageLoadingContent;
|
||||
HTMLInputElement implements MozPhonetic;
|
||||
|
||||
// Webkit/Blink
|
||||
partial interface HTMLInputElement {
|
||||
[Pref="dom.webkitBlink.filesystem.enabled", Cached, Constant, GetterThrows]
|
||||
readonly attribute sequence<Entry> webkitEntries;
|
||||
|
||||
[Pref="dom.webkitBlink.dirPicker.enabled", BinaryName="WebkitDirectoryAttr", SetterThrows]
|
||||
attribute boolean webkitdirectory;
|
||||
};
|
||||
|
||||
@@ -126,6 +126,7 @@ WEBIDL_FILES = [
|
||||
'DOMCursor.webidl',
|
||||
'DOMError.webidl',
|
||||
'DOMException.webidl',
|
||||
'DOMFileSystem.webidl',
|
||||
'DOMImplementation.webidl',
|
||||
'DominatorTree.webidl',
|
||||
'DOMMatrix.webidl',
|
||||
|
||||
Reference in New Issue
Block a user