Closed
Bug 1163388
Opened 9 years ago
Closed 9 years ago
Get rid of nsIDOMFile
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla41
Tracking | Status | |
---|---|---|
firefox40 | --- | affected |
People
(Reporter: baku, Assigned: baku)
References
Details
(Keywords: addon-compat)
Attachments
(3 files, 1 obsolete file)
30.38 KB,
patch
|
ehsan.akhgari
:
review+
|
Details | Diff | Splinter Review |
64.88 KB,
patch
|
ehsan.akhgari
:
review+
|
Details | Diff | Splinter Review |
69.19 KB,
patch
|
ehsan.akhgari
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Comment 1•9 years ago
|
||
Attachment #8605785 -
Flags: review?(ehsan)
Assignee | ||
Comment 2•9 years ago
|
||
Attachment #8605824 -
Flags: review?(ehsan)
Updated•9 years ago
|
Keywords: addon-compat
Updated•9 years ago
|
Attachment #8605785 -
Flags: review?(ehsan) → review+
Comment 3•9 years ago
|
||
Comment on attachment 8605824 [details] [diff] [review] patch 2 - get rid nsIDOMFile Review of attachment 8605824 [details] [diff] [review]: ----------------------------------------------------------------- Minusing because of the nsFilePickerProxy.cpp comment. ::: dom/base/nsIDOMFile.idl @@ -58,5 @@ > -// nsIDOMBlob to Blob safely. Our chain is: > -// - Blob -> nsIDOMBlob > -// - File -> nsIDOMFile and Blob > -[scriptable, builtinclass, uuid(26e292a6-f5aa-4560-b523-ae22a4c7dfca)] > -interface nsIDOMFile : nsISupports It would be nice if you renamed this file as nsIDOMBlob.idl (perhaps in a follow-up.) ::: dom/interfaces/base/nsIDOMWindowUtils.idl @@ +1448,2 @@ > */ > + nsISupports wrapDOMFile(in nsIFile aFile); Please rev the uuid of this interface. ::: dom/interfaces/html/nsIDOMHTMLCanvasElement.idl @@ +37,5 @@ > // Valid calls are > // mozGetAsFile(name); -- defaults to image/png > // mozGetAsFile(name, type); -- uses given type > + // The return value is a File object. > + nsISupports mozGetAsFile(in DOMString name, [optional] in DOMString type); Same. ::: widget/nsFilePickerProxy.cpp @@ +193,5 @@ > > NS_IMETHODIMP > nsFilePickerProxy::GetDomfiles(nsISimpleEnumerator** aDomfiles) > { > + // TODO Hmm, you're breaking this method, right? I don't understand what makes that OK. :-) ::: widget/nsIFilePicker.idl @@ +146,4 @@ > * > * @return Returns the file currently selected as File > */ > + readonly attribute nsISupports domfile; Please rev the uuid of this interface as well.
Attachment #8605824 -
Flags: review?(ehsan) → review-
Assignee | ||
Comment 4•9 years ago
|
||
Sorry, completely forgot about that TODO.
Attachment #8605824 -
Attachment is obsolete: true
Attachment #8605844 -
Flags: review?(ehsan)
Assignee | ||
Comment 5•9 years ago
|
||
Attachment #8605867 -
Flags: review?(ehsan)
Assignee | ||
Updated•9 years ago
|
Keywords: leave-open
Comment 6•9 years ago
|
||
Comment on attachment 8605844 [details] [diff] [review] patch 2 - get rid nsIDOMFile Review of attachment 8605844 [details] [diff] [review]: ----------------------------------------------------------------- ::: widget/nsFilePickerProxy.cpp @@ +197,5 @@ > +{ > +public: > + NS_DECL_ISUPPORTS > + > + SimpleEnumerator(nsTArray<nsRefPtr<File>>& aFiles) Please make this explicit. Also shouldn't the argument be const nsTArray&?
Attachment #8605844 -
Flags: review?(ehsan) → review+
Comment 7•9 years ago
|
||
Comment on attachment 8605867 [details] [diff] [review] patch 3 - make nsIDOMBlob an empty interface Review of attachment 8605867 [details] [diff] [review]: ----------------------------------------------------------------- r=me if the below are intentional. ::: dom/devicestorage/nsDeviceStorage.cpp @@ +2635,5 @@ > + if (NS_WARN_IF(rv.Failed())) { > + rv.SuppressException(); > + nsCOMPtr<nsIRunnable> event = > + new PostErrorEvent(mRequest.forget(), POST_ERROR_EVENT_UNKNOWN); > + return NS_DispatchToMainThread(event); This behavior change is intentional, right? ::: dom/filesystem/CreateFileTask.cpp @@ +41,5 @@ > if (aBlobData) { > if (FileSystemUtils::IsParentProcess()) { > + aBlobData->GetInternalStream(getter_AddRefs(mBlobStream), aRv); > + if (NS_WARN_IF(aRv.Failed())) { > + return; Is this correct? This can leave the object half-initialized.
Attachment #8605867 -
Flags: review?(ehsan) → review+
Assignee | ||
Comment 8•9 years ago
|
||
> > if (FileSystemUtils::IsParentProcess()) {
> > + aBlobData->GetInternalStream(getter_AddRefs(mBlobStream), aRv);
> > + if (NS_WARN_IF(aRv.Failed())) {
> > + return;
>
> Is this correct? This can leave the object half-initialized.
No, but the bug is in the current implementation. We should have a Init() method that can return errors instead having all of this code in the CTOR. I'll revert my code and file a follow up.
Assignee | ||
Updated•9 years ago
|
Summary: Ged rid of nsIDOMFile → Get rid of nsIDOMFile
https://hg.mozilla.org/integration/mozilla-inbound/rev/bbee8cb95f97 https://hg.mozilla.org/integration/mozilla-inbound/rev/a6bf6230c4a5
Assignee | ||
Comment 10•9 years ago
|
||
I'm landing the last patch separately because it introduces a memory leak. https://treeherder.mozilla.org/#/jobs?repo=try&revision=83525eb46832
Comment 11•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/bbee8cb95f97 https://hg.mozilla.org/mozilla-central/rev/a6bf6230c4a5
Assignee | ||
Comment 12•9 years ago
|
||
I'll work on the last patch in a separate bug because it's not related to nsIDOMFile.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Updated•9 years ago
|
Target Milestone: --- → mozilla41
Comment 13•9 years ago
|
||
Comment on attachment 8605844 [details] [diff] [review] patch 2 - get rid nsIDOMFile >- return NS_NewArrayEnumerator(aDomfiles, mDomfiles); >+ nsRefPtr<SimpleEnumerator> enumerator = new SimpleEnumerator(mDomfiles); Rather than rolling your own enumerator, could you not make mDomFiles an nsCOMArray<nsISupports>?
Assignee | ||
Comment 14•9 years ago
|
||
> >- return NS_NewArrayEnumerator(aDomfiles, mDomfiles);
> >+ nsRefPtr<SimpleEnumerator> enumerator = new SimpleEnumerator(mDomfiles);
> Rather than rolling your own enumerator, could you not make mDomFiles an
> nsCOMArray<nsISupports>?
More than this would be nice to have a template enumerator that take a nsTArray<nsRefPtr<T>>.
Otherwise all the code has to deal with a generic nsCOMArray<nsISupports> and this doesn't make the code readable.
Comment 15•6 years ago
|
||
Removing leave-open keyword from resolved bugs, per :sylvestre.
Keywords: leave-open
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•