Closed
Bug 1185381
Opened 9 years ago
Closed 9 years ago
Make FileList clonable
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla42
Tracking | Status | |
---|---|---|
firefox42 | --- | fixed |
People
(Reporter: baku, Assigned: baku)
References
Details
Attachments
(4 files, 1 obsolete file)
13.65 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
1.59 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
7.49 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
4.02 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
Currently we clone FileList only window to window.
In order to unify the postMessages (in workers, MessagePort, etc) FileList must be fully clonable.
Comment 1•9 years ago
|
||
To be more precise, looks like we currently just share FileLists between same origin windows. No cloning happening.
Assignee | ||
Comment 2•9 years ago
|
||
This patch just moves the code of FileList in 2 separate files.
Attachment #8635833 -
Flags: review?(bugs)
Assignee | ||
Comment 3•9 years ago
|
||
Attachment #8635834 -
Flags: review?(bugs)
Comment 4•9 years ago
|
||
Comment on attachment 8635834 [details] [diff] [review]
part2: BLOBIMPL_IID
I guess there isn't technically any need to change the IID in this kind of case.
Attachment #8635834 -
Flags: review?(bugs) → review+
Updated•9 years ago
|
Attachment #8635833 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 5•9 years ago
|
||
Here the cloning part. Basically it creates a thread-safe FileListClonedData object that is sent to the destination. It's thread-safe because I need to use it for worker postMessages.
Attachment #8635835 -
Flags: review?(bugs)
Assignee | ||
Comment 6•9 years ago
|
||
Attachment #8635836 -
Flags: review?(bugs)
Comment 7•9 years ago
|
||
Comment on attachment 8635835 [details] [diff] [review]
part 3: FileListClonedData
>+FileList::Create(nsISupports *aParent, FileListClonedData* aData)
nsISupports* aParent
>+ // What we get back from the reader is a FileListClonedData.
>+ // From that we create a new FileList.
>+ FileListClonedData* fileListClonedData;
>+ if (JS_ReadBytes(reader, &fileListClonedData, sizeof(fileListClonedData))) {
>+ MOZ_ASSERT(fileListClonedData);
Ah, this is the reason for FileListClonedData.
You could have used also just nsTArray<nsRefPtr<BlobImpl>> I think, but perhaps this is a bit nicer,
since StoreISupports can be reused this way.
>+ // See if this is a FileList object.
>+ {
>+ FileList* fileList = nullptr;
>+ if (NS_SUCCEEDED(UNWRAP_OBJECT(FileList, obj, fileList))) {
>+ nsRefPtr<FileListClonedData> fileListClonedData =
>+ fileList->CreateClonedData();
>+ MOZ_ASSERT(fileListClonedData);
>+ FileListClonedData* ptr = fileListClonedData.get();
>+ if (JS_WriteUint32Pair(writer, SCTAG_DOM_FILELIST, 0) &&
>+ JS_WriteBytes(writer, &ptr, sizeof(ptr))) {
>+ scInfo->event->StoreISupports(fileListClonedData);
>+ return true;
>+ }
So StoreISupports
Attachment #8635835 -
Flags: review?(bugs) → review+
Comment 8•9 years ago
|
||
Comment on attachment 8635836 [details] [diff] [review]
part 4: tests
So the subsumes removal patch will add a test where filelist is cloned across domains, right?
Attachment #8635836 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 9•9 years ago
|
||
I improved the tests to support cross-origin fileList + blob cloning.
Attachment #8635836 -
Attachment is obsolete: true
Attachment #8635899 -
Flags: review?(bugs)
Assignee | ||
Comment 10•9 years ago
|
||
Comment 11•9 years ago
|
||
Comment on attachment 8635899 [details] [diff] [review]
part 4: tests
I would use just "iframe_cloning_fileList.html" for the same origin.
I never recall which port is the default port while running mochitests.
Attachment #8635899 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 12•9 years ago
|
||
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/da598d1d8f73
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/9b04e954b2b2
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/1af9f6c0ed28
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/5c58139ed723
Comment 13•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/da598d1d8f73
https://hg.mozilla.org/mozilla-central/rev/9b04e954b2b2
https://hg.mozilla.org/mozilla-central/rev/1af9f6c0ed28
https://hg.mozilla.org/mozilla-central/rev/5c58139ed723
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
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
•