Closed Bug 1289255 Opened 8 years ago Closed 8 years ago

Implement DataTransferItem.webkitGetAsEntry

Categories

(Core :: DOM: Core & HTML, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla50
Tracking Status
firefox50 --- fixed

People

(Reporter: smaug, Assigned: smaug)

References

Details

(Keywords: dev-doc-complete)

Attachments

(2 files, 1 obsolete file)

      No description provided.
Depends on: 1289254
Bug 1289254 adds IsDirectory() to BlobImpl which should make this rather trivial.
Priority: -- → P2
Attached patch wip (obsolete) — Splinter Review
I took the patch 7 from bug 1284987 and added support for DOMFileSystem and
directories.

The only issue I know atm is that FileEntry doesn't have fullpath.
baku, how would one get fullpath information to the FileEntries?
Basically /<filename>
Assignee: nobody → bugs
Flags: needinfo?(amarchesini)
Attachment #8774948 - Flags: feedback?(amarchesini)
Looks like my patch for bug Bug 1289254 has the same issue with FileEntries. They are missing the fullpath
Depends on: 1289900
Attached patch patchSplinter Review
Attachment #8774948 - Attachment is obsolete: true
Attachment #8774948 - Flags: feedback?(amarchesini)
Attachment #8775320 - Flags: review?(amarchesini)
Blocks: 1188880
Comment on attachment 8775320 [details] [diff] [review]
patch

Review of attachment 8775320 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/events/DataTransferItem.cpp
@@ +282,5 @@
> +  }
> +
> +  nsCOMPtr<nsIGlobalObject> global;
> +  RefPtr<DataTransfer> dataTransfer;
> +  RefPtr<DataTransferItemList> list = GetParentObject();

Nit, but just to make this code more readable, what about if we do:

if (!list) {
  return nullptr;
}

RefPtr<DataTransfer> dataTransfer = list->GetParentObject();
if (!dataTransfer) {
  return nullptr;
}

@@ +306,5 @@
> +    return nullptr;
> +  }
> +
> +  RefPtr<DOMFileSystem> fs = DOMFileSystem::Create(global);
> +  Sequence<RefPtr<Entry>> entries;

move this  to line  336.

@@ +309,5 @@
> +  RefPtr<DOMFileSystem> fs = DOMFileSystem::Create(global);
> +  Sequence<RefPtr<Entry>> entries;
> +  RefPtr<Entry> entry;
> +
> +  BlobImpl* impl = file->Impl();

MOZ_ASSERT(impl);

and remove if(impl) part.

@@ +320,5 @@
> +    }
> +
> +    nsCOMPtr<nsIFile> directoryFile;
> +    NS_ConvertUTF16toUTF8 path(fullpath);
> +    nsresult rv = NS_NewNativeLocalFile(path, true,

nsresult rv = NS_NewNativeLocalFile(NS_ConvertUTF16toUTF8(fullPath),
                                    true, getter_...);
Attachment #8775320 - Flags: review?(amarchesini) → review+
Flags: needinfo?(amarchesini)
Pushed by opettay@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/5e254e995379
Implement DataTransferItem.webkitGetAsEntry, r=baku
https://hg.mozilla.org/mozilla-central/rev/5e254e995379
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
Documented, with lovely live sample to boot (which is reused on other pages about file system, too):

https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/webkitGetAsEntry

Updated https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem to include it.

Listed on Firefox 50 for developers.
Depends on: 1323935
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: