Skip to content

Commit

Permalink
Bug 1295570 - Entries API - part 7 - Split WebIDL files, r=smaug
Browse files Browse the repository at this point in the history
  • Loading branch information
bakulf committed Aug 18, 2016
1 parent 1a7e0c9 commit 0ab7a88
Show file tree
Hide file tree
Showing 14 changed files with 114 additions and 80 deletions.
1 change: 1 addition & 0 deletions dom/filesystem/compat/CallbackRunnables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "mozilla/dom/DOMError.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/FileBinding.h"
#include "mozilla/dom/FileSystemDirectoryReaderBinding.h"
#include "mozilla/dom/FileSystemFileEntry.h"
#include "mozilla/dom/Promise.h"
#include "nsIGlobalObject.h"
Expand Down
2 changes: 2 additions & 0 deletions dom/filesystem/compat/CallbackRunnables.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class nsIGlobalObject;
namespace mozilla {
namespace dom {

class FileSystemEntriesCallback;

class EntryCallbackRunnable final : public Runnable
{
public:
Expand Down
1 change: 1 addition & 0 deletions dom/filesystem/compat/FileSystemDirectoryEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "CallbackRunnables.h"
#include "FileSystemDirectoryReader.h"
#include "mozilla/dom/Directory.h"
#include "mozilla/dom/FileSystemDirectoryEntryBinding.h"
#include "mozilla/dom/FileSystemUtils.h"

namespace mozilla {
Expand Down
1 change: 1 addition & 0 deletions dom/filesystem/compat/FileSystemDirectoryEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace mozilla {
namespace dom {

class Directory;
class FileSystemDirectoryReader;

class FileSystemDirectoryEntry : public FileSystemEntry
{
Expand Down
1 change: 1 addition & 0 deletions dom/filesystem/compat/FileSystemDirectoryReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace dom {

class Directory;
class FileSystem;
class FileSystemEntriesCallback;

class FileSystemDirectoryReader
: public nsISupports
Expand Down
1 change: 1 addition & 0 deletions dom/filesystem/compat/FileSystemEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "FileSystemEntry.h"
#include "FileSystemDirectoryEntry.h"
#include "FileSystemFileEntry.h"
#include "mozilla/dom/FileSystemEntryBinding.h"
#include "mozilla/dom/UnionTypes.h"

namespace mozilla {
Expand Down
1 change: 1 addition & 0 deletions dom/filesystem/compat/FileSystemFileEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "FileSystemFileEntry.h"
#include "CallbackRunnables.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/FileSystemFileEntryBinding.h"

namespace mozilla {
namespace dom {
Expand Down
1 change: 1 addition & 0 deletions dom/filesystem/compat/FileSystemFileEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace mozilla {
namespace dom {

class File;
class BlobCallback;

class FileSystemFileEntry final : public FileSystemEntry
{
Expand Down
80 changes: 0 additions & 80 deletions dom/webidl/FileSystem.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,6 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/

[NoInterfaceObject]
interface FileSystemEntry {
readonly attribute boolean isFile;
readonly attribute boolean isDirectory;

[GetterThrows]
readonly attribute DOMString name;

[GetterThrows]
readonly attribute DOMString fullPath;

readonly attribute FileSystem filesystem;

/** Not implemented:
* void getMetadata(MetadataCallback successCallback,
* optional ErrorCallback errorCallback);
* void moveTo(FileSystemDirectoryEntry parent, optional DOMString? name,
* optional FileSystemEntryCallback successCallback,
* optional ErrorCallback errorCallback);
* void copyTo(FileSystemDirectoryEntry parent, optional DOMString? name,
* optional FileSystemEntryCallback successCallback,
* optional ErrorCallback errorCallback);
* DOMString toURL();
* void remove(VoidCallback successCallback,
* optional ErrorCallback errorCallback);
* void getParent(optional FileSystemEntryCallback successCallback,
* optional ErrorCallback errorCallback);
*/
};

dictionary FileSystemFlags {
boolean create = false;
Expand All @@ -47,62 +18,11 @@ callback interface VoidCallback {
void handleEvent();
};

[NoInterfaceObject]
interface FileSystemDirectoryEntry : FileSystemEntry {
FileSystemDirectoryReader createReader();

void getFile(DOMString? path,
optional FileSystemFlags options,
optional FileSystemEntryCallback successCallback,
optional ErrorCallback errorCallback);

void getDirectory(DOMString? path,
optional FileSystemFlags options,
optional FileSystemEntryCallback successCallback,
optional ErrorCallback errorCallback);

// This method is not implemented. ErrorCallback will be called
// with NS_ERROR_DOM_NOT_SUPPORTED_ERR.
void removeRecursively(VoidCallback successCallback,
optional ErrorCallback errorCallback);
};

callback interface FileSystemEntriesCallback {
void handleEvent(sequence<FileSystemEntry> entries);
};

callback interface ErrorCallback {
// This should be FileError but we are implementing just a subset of this API.
void handleEvent(DOMError error);
};

[NoInterfaceObject]
interface FileSystemDirectoryReader {

// readEntries can be called just once. The second time it returns no data.

[Throws]
void readEntries(FileSystemEntriesCallback successCallback,
optional ErrorCallback errorCallback);
};

callback interface BlobCallback {
void handleEvent(Blob? blob);
};

[NoInterfaceObject]
interface FileSystemFileEntry : FileSystemEntry {
// the successCallback should be a FileWriteCallback but this method is not
// implemented. ErrorCallback will be called with
// NS_ERROR_DOM_NOT_SUPPORTED_ERR.
void createWriter (VoidCallback successCallback,
optional ErrorCallback errorCallback);

[BinaryName="GetFile"]
void file (BlobCallback successCallback,
optional ErrorCallback errorCallback);
};

[NoInterfaceObject]
interface FileSystem {
readonly attribute DOMString name;
Expand Down
25 changes: 25 additions & 0 deletions dom/webidl/FileSystemDirectoryEntry.webidl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* -*- 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 FileSystemDirectoryEntry : FileSystemEntry {
FileSystemDirectoryReader createReader();

void getFile(DOMString? path,
optional FileSystemFlags options,
optional FileSystemEntryCallback successCallback,
optional ErrorCallback errorCallback);

void getDirectory(DOMString? path,
optional FileSystemFlags options,
optional FileSystemEntryCallback successCallback,
optional ErrorCallback errorCallback);

// This method is not implemented. ErrorCallback will be called
// with NS_ERROR_DOM_NOT_SUPPORTED_ERR.
void removeRecursively(VoidCallback successCallback,
optional ErrorCallback errorCallback);
};
19 changes: 19 additions & 0 deletions dom/webidl/FileSystemDirectoryReader.webidl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* -*- 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/.
*/

callback interface FileSystemEntriesCallback {
void handleEvent(sequence<FileSystemEntry> entries);
};

[NoInterfaceObject]
interface FileSystemDirectoryReader {

// readEntries can be called just once. The second time it returns no data.

[Throws]
void readEntries(FileSystemEntriesCallback successCallback,
optional ErrorCallback errorCallback);
};
35 changes: 35 additions & 0 deletions dom/webidl/FileSystemEntry.webidl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* -*- 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 FileSystemEntry {
readonly attribute boolean isFile;
readonly attribute boolean isDirectory;

[GetterThrows]
readonly attribute DOMString name;

[GetterThrows]
readonly attribute DOMString fullPath;

readonly attribute FileSystem filesystem;

/** Not implemented:
* void getMetadata(MetadataCallback successCallback,
* optional ErrorCallback errorCallback);
* void moveTo(FileSystemDirectoryEntry parent, optional DOMString? name,
* optional FileSystemEntryCallback successCallback,
* optional ErrorCallback errorCallback);
* void copyTo(FileSystemDirectoryEntry parent, optional DOMString? name,
* optional FileSystemEntryCallback successCallback,
* optional ErrorCallback errorCallback);
* DOMString toURL();
* void remove(VoidCallback successCallback,
* optional ErrorCallback errorCallback);
* void getParent(optional FileSystemEntryCallback successCallback,
* optional ErrorCallback errorCallback);
*/
};
22 changes: 22 additions & 0 deletions dom/webidl/FileSystemFileEntry.webidl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* -*- 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/.
*/

callback interface BlobCallback {
void handleEvent(Blob? blob);
};

[NoInterfaceObject]
interface FileSystemFileEntry : FileSystemEntry {
// the successCallback should be a FileWriteCallback but this method is not
// implemented. ErrorCallback will be called with
// NS_ERROR_DOM_NOT_SUPPORTED_ERR.
void createWriter (VoidCallback successCallback,
optional ErrorCallback errorCallback);

[BinaryName="GetFile"]
void file (BlobCallback successCallback,
optional ErrorCallback errorCallback);
};
4 changes: 4 additions & 0 deletions dom/webidl/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ WEBIDL_FILES = [
'FileReader.webidl',
'FileReaderSync.webidl',
'FileSystem.webidl',
'FileSystemDirectoryEntry.webidl',
'FileSystemDirectoryReader.webidl',
'FileSystemEntry.webidl',
'FileSystemFileEntry.webidl',
'FlyWebDiscoveryManager.webidl',
'FlyWebFetchEvent.webidl',
'FlyWebPublish.webidl',
Expand Down

0 comments on commit 0ab7a88

Please sign in to comment.