Skip to content

Commit

Permalink
move and rename getOriginPrivateDirectory to StorageManager
Browse files Browse the repository at this point in the history
  • Loading branch information
mkruisselbrink committed Aug 14, 2020
1 parent a6a04c8 commit 6192c45
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,5 +165,5 @@ let root = await FileSystemDirectoryHandle.getSystemDirectory(type: 'sandbox');

**After (in Chrome M86)**
```javascript
let root = await self.getOriginPrivateDirectory();
let root = await navigator.storage.getDirectory();
```
18 changes: 10 additions & 8 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ cases where a website wants to save data to disk before a user has picked a
location to save to, without forcing the website to use a completely different
storage mechanism with a different API for such files. It also makes it easier
to write automated tests for code using this API. The entry point for this is the
{{getOriginPrivateDirectory()}} method. This is similar to the temporary file
system as defined in earlier drafts of [[file-system-api|File API: Directories and System]].
{{StorageManager/getDirectory()|navigator.storage.getDirectory()}} method. This
is similar to the temporary file system as defined in earlier drafts of
[[file-system-api|File API: Directories and System]].

# Files and Directories # {#files-and-directories}

Expand Down Expand Up @@ -109,7 +110,8 @@ An [=/entry=]'s [=entry/parent=] is null if no such directory entry exists.
Note: Two different [=/entries=] can represent the same file or directory on disk, in which
case it is possible for both entries to have a different parent, or for one entry to have a
parent while the other entry does not have a parent. Typically an entry does not have a parent
if it was returned by {{getOriginPrivateDirectory()}} or one of the [=native file system handle factories=],
if it was returned by {{StorageManager/getDirectory()|navigator.storage.getDirectory()}}
or one of the [=native file system handle factories=],
and an entry will have a parent in all other cases.

[=/Entries=] can (but don't have to) be backed by files on the systems native file system,
Expand Down Expand Up @@ -1394,7 +1396,7 @@ run these steps:
1. If |parsedType|'s [=MIME type/type=] is "*", return `true`.
1. If |parsedType|'s [=MIME type/type=] is |type|'s [=MIME type/type=], return `true`.
1. |parsedType|'s [=MIME type/essence=] is |type|'s [=MIME type/essence=], return `true`.
1. If |extensions| is a string, set |extensions| to a [=list=] with a single
1. If |extensions| is a string, set |extensions| to a [=/list=] with a single
element equal to |extensions|.
1. [=list/For each=] |extension| of |extensions|:
1. If |filename| ends with "." followed by |extension|, return `true`.
Expand Down Expand Up @@ -1565,21 +1567,21 @@ matching the names of children of the [=origin private file system=] exist.

<xmp class=idl>
[SecureContext]
partial interface mixin WindowOrWorkerGlobalScope {
Promise<FileSystemDirectoryHandle> getOriginPrivateDirectory();
partial interface StorageManager {
Promise<FileSystemDirectoryHandle> getDirectory();
};
</xmp>

Advisement: In Chrome this functionality was previously exposed as `FileSystemDirectoryHandle.getSystemDirectory({type: "sandbox"})`.
This new method is available as of Chrome 85.

<div class="note domintro">
: |directoryHandle| = await window . {{getOriginPrivateDirectory()}}
: |directoryHandle| = await navigator . storage . {{StorageManager/getDirectory()}}
:: Returns the root directory of the origin private file system.
</div>

<div algorithm>
The <dfn method for=WindowOrWorkerGlobalScope>getOriginPrivateDirectory()</dfn> method, when
The <dfn method for=StorageManager>getDirectory()</dfn> method, when
invoked, must run these steps:

1. Let |environment| be the [=current settings object=].
Expand Down

0 comments on commit 6192c45

Please sign in to comment.