Closed
Bug 1164310
Opened 10 years ago
Closed 10 years ago
Implement MS's proposal for a reduced subset of the new FileSystem API
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla42
People
(Reporter: jwatt, Assigned: jwatt)
References
(Depends on 1 open bug, )
Details
(Keywords: dev-doc-needed, devrel-needed)
Attachments
(6 files)
3.68 KB,
patch
|
baku
:
review+
|
Details | Diff | Splinter Review |
14.38 KB,
patch
|
baku
:
review+
|
Details | Diff | Splinter Review |
2.82 KB,
patch
|
baku
:
review+
|
Details | Diff | Splinter Review |
15.39 KB,
patch
|
baku
:
review+
|
Details | Diff | Splinter Review |
12.09 KB,
patch
|
tnikkel
:
review+
|
Details | Diff | Splinter Review |
7.76 KB,
patch
|
baku
:
review+
|
Details | Diff | Splinter Review |
+++ This bug was initially created as a clone of Bug #846931 +++
Bug 846931 has proceeded on the basis of allowing users to select directories while having the browser then act in a way that is compatible with legacy websites.
To avoid a confusing morphing of that bug I'm spinning of this new bug to cover implementing Microsoft's proposal for a subset of the new FileSystem API, a proposal which would not "just work" with existing webpages but rather would require opt-in from new pages. More info on that proposal can be found here:
https://lists.w3.org/Archives/Public/public-webapps/2015AprJun/0245.html
Thank you for spinning off this bug!
This API would be very useful to us. We currently have uploading functionality (for very large directory hierarchies) that is only supported in Chrome and Opera.
The proposed API would be able to replace the Chrome/Opera one, and it would allow us to support those uploads in Firefox and Edge as well.
Assignee | ||
Comment 2•10 years ago
|
||
Attachment #8628919 -
Flags: review?(amarchesini)
Assignee | ||
Comment 3•10 years ago
|
||
Attachment #8628920 -
Flags: review?(amarchesini)
Assignee | ||
Comment 4•10 years ago
|
||
Attachment #8628921 -
Flags: review?(amarchesini)
Assignee | ||
Comment 5•10 years ago
|
||
Attachment #8628925 -
Flags: review?(amarchesini)
Assignee | ||
Comment 6•10 years ago
|
||
Attachment #8628959 -
Flags: review?(dholbert)
Assignee | ||
Updated•10 years ago
|
Attachment #8628959 -
Flags: review?(dholbert) → review?(tnikkel)
Assignee | ||
Comment 7•10 years ago
|
||
Assignee | ||
Updated•10 years ago
|
Attachment #8629016 -
Attachment is patch: true
Attachment #8629016 -
Flags: review?(amarchesini)
Updated•10 years ago
|
Attachment #8628959 -
Flags: review?(tnikkel) → review+
Updated•10 years ago
|
Attachment #8628919 -
Flags: review?(amarchesini) → review+
Comment 8•10 years ago
|
||
Comment on attachment 8628920 [details] [diff] [review]
part 2 - Implement an abstraction for a rooted filesystem for non-mobile devices
Review of attachment 8628920 [details] [diff] [review]:
-----------------------------------------------------------------
lgtm!
::: dom/filesystem/OSFileSystem.cpp
@@ +36,5 @@
> +
> +void
> +OSFileSystem::Init(nsPIDOMWindow* aWindow)
> +{
> + MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
MOZ_ASSERT(!mWindow, "No duple Init() calls"); Could it make sense?
@@ +45,5 @@
> +nsPIDOMWindow*
> +OSFileSystem::GetWindow() const
> +{
> + MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
> + if (!mWindow) {
this is not needed.
I think you can just do:
return mWindow;
@@ +63,5 @@
> +{
> + // The concept of "safe files" is specific to the Device Storage API where
> + // files are only "safe" if they're of a type that is appropriate for the
> + // area of device storage that is being used.
> + MOZ_ASSERT(false, "Don't use OSFileSystem with the Device Storage API");
MOZ_CRASH
@@ +73,5 @@
> +{
> + // The concept of "safe directory" is specific to the Device Storage API
> + // where a directory is only "safe" if it belongs to the area of device
> + // storage that it is being used with.
> + MOZ_ASSERT(false, "Don't use OSFileSystem with the Device Storage API");
MOZ_CRASH
::: dom/filesystem/OSFileSystem.h
@@ +43,5 @@
> +} // namespace dom
> +} // namespace mozilla
> +
> +#endif // mozilla_dom_OSFileSystem_h
> +
extra line at the bottom of this file.
Attachment #8628920 -
Flags: review?(amarchesini) → review+
Updated•10 years ago
|
Attachment #8628921 -
Flags: review?(amarchesini) → review+
Comment 9•10 years ago
|
||
Comment on attachment 8628925 [details] [diff] [review]
part 4 - Implement the new HTMLInputElement API including the new Promise returning GetFilesAndDirectories
Review of attachment 8628925 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/html/HTMLInputElement.cpp
@@ +3564,5 @@
> + if (target &&
> + target->GetParent() == this &&
> + target->IsRootOfNativeAnonymousSubtree() &&
> + target->HasAttr(kNameSpaceID_None, nsGkAtoms::directory)) {
> + MOZ_ASSERT(Preferences::GetBool("dom.input.dirpicker", false),
I really would like to see a test for this :)
@@ +4827,5 @@
> +
> +bool
> +HTMLInputElement::IsFilesAndDirectoriesSupported() const
> +{
> + // This method is supposed to return true if a file and directory picker
80chars?
@@ +4838,5 @@
> +void
> +HTMLInputElement::ChooseDirectory(ErrorResult& aRv)
> +{
> + if (mType != NS_FORM_INPUT_FILE) {
> + aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return;
@@ +4853,5 @@
> +static already_AddRefed<OSFileSystem>
> +MakeOrReuseFileSystem(const nsAString& aNewLocalRootPath,
> + OSFileSystem* aFS,
> + nsPIDOMWindow* aWindow)
> +{
MOZ_ASSERT(aWindow);
@@ +4891,5 @@
> + p->MaybeReject(NS_ERROR_OUT_OF_MEMORY);
> + return p.forget();
> + }
> +
> + nsPIDOMWindow* window = OwnerDoc()->GetInnerWindow(); // XXXjwatt correct thing?
why this comment?
I guess yes, you want to use the inner window.
Attachment #8628925 -
Flags: review?(amarchesini) → review+
Comment 10•10 years ago
|
||
Comment on attachment 8629016 [details] [diff] [review]
part 6 - Implement the new Promise returning DataTransfer.getFilesAndDirectories() API
Review of attachment 8629016 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/events/DataTransfer.cpp
@@ +8,5 @@
> #include "mozilla/BasicEvents.h"
>
> #include "DataTransfer.h"
>
> +#include "mozilla/dom/Directory.h"
why here on top and not with the other mozilla/dom/ headers?
@@ +833,5 @@
> +static already_AddRefed<OSFileSystem>
> +MakeOrReuseFileSystem(const nsAString& aNewLocalRootPath,
> + OSFileSystem* aFS,
> + nsPIDOMWindow* aWindow)
> +{
MOZ_ASSERT(aWindow);
@@ +904,5 @@
> + nsDependentSubstring basename = Substring(path, leafSeparatorIndex);
> + fs = MakeOrReuseFileSystem(dirname, fs, window);
> + filesAndDirsSeq[i].SetAsDirectory() = new Directory(fs, basename);
> + } else {
> + filesAndDirsSeq[i].SetAsFile() = mFiles->Item(i);
This is equal to what I just reviewed in the previous patch. Correct?
Wondering if we can unify these 2 blocks (this and HTMLInputElement::GetFilesAndDirectories.
Attachment #8629016 -
Flags: review?(amarchesini) → review+
Comment 13•10 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/d9f93c3850e9
https://hg.mozilla.org/integration/mozilla-inbound/rev/4216422f8500
https://hg.mozilla.org/integration/mozilla-inbound/rev/0a945cb91184
https://hg.mozilla.org/integration/mozilla-inbound/rev/c6a6d9d77dd5
https://hg.mozilla.org/integration/mozilla-inbound/rev/728bc2eed910
https://hg.mozilla.org/integration/mozilla-inbound/rev/c09134abb278
https://hg.mozilla.org/integration/mozilla-inbound/rev/c986072df4cb
Comment 14•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/d9f93c3850e9
https://hg.mozilla.org/mozilla-central/rev/4216422f8500
https://hg.mozilla.org/mozilla-central/rev/0a945cb91184
https://hg.mozilla.org/mozilla-central/rev/c6a6d9d77dd5
https://hg.mozilla.org/mozilla-central/rev/728bc2eed910
https://hg.mozilla.org/mozilla-central/rev/c09134abb278
https://hg.mozilla.org/mozilla-central/rev/c986072df4cb
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
status-firefox42:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
Comment 16•10 years ago
|
||
\o/
Comment 17•10 years ago
|
||
Assignee | ||
Comment 19•10 years ago
|
||
It's controlled by the pref dom.input.dirpicker which is on in Nightly only, for now.
Flags: needinfo?(jwatt)
Comment 20•10 years ago
|
||
Is the drag an drop part of this finished? I seem to get a File when dropping a directory. The <input> part is working great, though!
Flags: needinfo?(jwatt)
Comment 21•10 years ago
|
||
To further clarify: When dropping a single directory event.dataTransfer.getFilesAndDirectories() seems to return a File instead of an expected Directory. I can file a bug if you like.
Assignee | ||
Comment 22•10 years ago
|
||
Seems to work for me. Can you file a bug please?
Flags: needinfo?(jwatt)
Updated•9 years ago
|
Keywords: devrel-needed
Comment 23•9 years ago
|
||
Sorry for maybe asking a newbie question about the release process, but how can I find out when this will be in Firefox _stable_? I've tested Nightly 45 and really liked this feature, but Firefox 42 does not ship it despite this ticket has a flag "status-firefox42: fixed".
Comment 24•9 years ago
|
||
That's a good question, not a newbie one. ;)
This bug implemented the functionality behind a preference ("dom.input.dirpicker" to be precise). This preference is currently only set to true by default in nightly builds.
Bug 1188880 (blocked by this bug) tracks enabling in release builds. Note that it has several unresolved dependencies blocking it.
Comment 25•9 years ago
|
||
It's currently not possible to upload a folder into Firefox to upload it to cloud storage (Google Drive, One Drive, Sirv, Dropbox or others). When will this be possible? The need for folder uploading is growing and has already received many votes on this related thread:
https://bugzilla.mozilla.org/show_bug.cgi?id=876480
It should be possible to upload folders by both drag and drop and file browsing.
Comment 26•8 years ago
|
||
I can verify that uploading folders via drag-and-drop now works in Firefox 51.0. However, it doesn't work in SeaMonkey 2.46. Are there plans for this functionality to be added to SeaMonkey or should I open a new issue?
Comment 27•8 years ago
|
||
Well done to everyone that worked on this - folder uploading in Firefox is fantastic, really helpful!
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•