Closed
Bug 1206030
Opened 9 years ago
Closed 9 years ago
Remove nsIDOMHTMLCanvasElement::MozFetchAsStream()
Categories
(Core :: Graphics: Canvas2D, defect)
Core
Graphics: Canvas2D
Tracking
()
RESOLVED
FIXED
mozilla43
Tracking | Status | |
---|---|---|
firefox43 | --- | fixed |
People
(Reporter: ttaubert, Assigned: ttaubert)
Details
(Keywords: addon-compat, dev-doc-complete)
Attachments
(1 file)
5.07 KB,
patch
|
jst
:
review+
Ms2ger
:
feedback+
|
Details | Diff | Splinter Review |
I introduced this a long time ago when working on the thumbnail service for the newtab page. The thumbnail service doesn't use it anymore and there are no add-ons out there using it either, let's get rid of it.
Assignee | ||
Updated•9 years ago
|
Keywords: dev-doc-needed
Assignee | ||
Comment 1•9 years ago
|
||
Assignee | ||
Updated•9 years ago
|
Summary: Remove nsIDOMHTMLCanvasElement::mozFetchAsStream() → Remove nsIDOMHTMLCanvasElement::MozFetchAsStream()
Comment 2•9 years ago
|
||
Comment on attachment 8662884 [details] [diff] [review]
0001-Bug-1206030-Remove-nsIDOMHTMLCanvasElement-mozFetchA.patch
Review of attachment 8662884 [details] [diff] [review]:
-----------------------------------------------------------------
I like, but you'll need a peer.
Attachment #8662884 -
Flags: review?(jst)
Attachment #8662884 -
Flags: review?(Ms2ger)
Attachment #8662884 -
Flags: feedback+
Assignee | ||
Comment 3•9 years ago
|
||
(In reply to :Ms2ger from comment #2)
> I like, but you'll need a peer.
Thought you were a peer, sorry :) Thanks for forwarding!
Comment 4•9 years ago
|
||
Comment on attachment 8662884 [details] [diff] [review]
0001-Bug-1206030-Remove-nsIDOMHTMLCanvasElement-mozFetchA.patch
I like removal of code we no longer need! r=jst
Attachment #8662884 -
Flags: review?(jst) → review+
Comment 6•9 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox43:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
Comment 7•9 years ago
|
||
https://developer.mozilla.org/en-US/Firefox/Releases/43#Changes_for_add-on_and_Mozilla_developers
https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/mozFetchAsStream
Keywords: dev-doc-needed → dev-doc-complete
Assignee | ||
Comment 8•9 years ago
|
||
Thanks Florian!
Was the justification to remove this purely that other addons dont use it? :(
I use it I use it in my addon :(
Its amazing. Because my goal is to post canvas data to a new tab. I do it here in Nativeshot I use it: https://github.com/Noitidart/NativeShot/blob/master/bootstrap.js#L1677
I feed the stream directly to nsIMultiplexStream: https://github.com/Noitidart/NativeShot/blob/master/bootstrap.js#L4528
The alternative is not as speedy or memory friendly. I would have to take it to blob. Then use file reader to convert to arraybuffer. then use nsIArrayBufferInputStream. I tried this approach but when arraybuffer is bigger then 64k it messes it up somehow.
Is there a chance we can still keep this?
Comment 10•9 years ago
|
||
This stackoverflow topic explains what i mean by "post to tab":
http://stackoverflow.com/questions/25009431/replication-of-form-method-with-loadonetab/25020668#25020668
And here is a copy paste example just change the file path here to an image on your disk: https://github.com/Noitidart/_scratchpad/blob/5bcdb8d2c8358e2c2656b601ae0e960cc34c190b/upload%20image%20search%20to%20google.js#L65
And then copy paste that to scratchpad. It will open a new tab with the search results of matching images.
Comment 11•9 years ago
|
||
The scratchpad copy paste example uses the very less performant nsIFile method. In my production i use mozFetchAsStream which is much more performant then the nsiFile method. And nsIFile will be deprecated eventually for sure, and it makes sense, as OS.File is fully async and very safe.
Comment 12•9 years ago
|
||
I know my addon only has 10 users but thats because it hasn't been approved yet. My addon is going to replace LightShot addon which has 50k users, but that's Windows only. Mine also supports Linux and OS X so I'll easily have over 50k.
Here's a screencast showing how I use mozFetchAsStream to send data from canvas to loadOneTab as postData: https://www.youtube.com/watch?v=PhR0UWEwUvA
mozFetchAsStream is the fastest best way. And for postData to loadOneTab or XHR its just exceptional.
Comment 13•9 years ago
|
||
(In reply to Tim Taubert [:ttaubert] from comment #0)
> there are no add-ons out there using it either
Not sure how you checked that but one of my add-ons used it too.
Assignee | ||
Comment 14•9 years ago
|
||
Looks like I might have missed a few. Not sure how often we update the add-on MXR.
Comment 15•9 years ago
|
||
Thanks @Geoff for chiming in.
Thanks so much @Tim if you can help bring this back. Could you tell us the chances of that please?
Do you know if my tests of "mozFetchAsStream direct to nsIMultiplexStream" being more performant then "canvas read to blob, then reading as array buffer, then putting into nsIArrayBufferInputStream, then finally adding to nsIMultiplexStream" are true? And do you expect it to be by a lot?
Comment 16•9 years ago
|
||
(In reply to Tim Taubert [:ttaubert] from comment #14)
> Looks like I might have missed a few. Not sure how often we update the
> add-on MXR.
Hi there Tim, may you please update us on if there is chance we can get this back. My beta channel just updated to Firefox 43 and mozFetchAsStream is gone :(
Flags: needinfo?(ttaubert)
Assignee | ||
Comment 17•9 years ago
|
||
Sorry, we have no plans to bring this back. This was never intended to be used by add-ons and was implicitly slated for removal as soon as we can. Sticking to standardized methods is the way to go.
Flags: needinfo?(ttaubert)
Comment 18•9 years ago
|
||
(In reply to Tim Taubert [:ttaubert] from comment #17)
> Sorry, we have no plans to bring this back. This was never intended to be
> used by add-ons and was implicitly slated for removal as soon as we can.
> Sticking to standardized methods is the way to go.
Aw darn. Can you please mention the standard methods.
Flags: needinfo?(ttaubert)
Assignee | ||
Comment 19•9 years ago
|
||
(In reply to noitidart from comment #18)
> Can you please mention the standard methods.
I was referring to the canvas element API:
https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement
Flags: needinfo?(ttaubert)
Updated•9 years ago
|
Keywords: addon-compat
Comment 20•9 years ago
|
||
(In reply to Tim Taubert [:ttaubert] from comment #19)
> (In reply to noitidart from comment #18)
> > Can you please mention the standard methods.
>
> I was referring to the canvas element API:
>
> https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement
Hi Tim, may you please check out this topic - https://discourse.mozilla-community.org/t/post-arraybuffer-to-loadonetab/6224
Instead of canvas.mozFetchAsStream, then adding that stream directly to the nsIMultiplexInputStream - I am now doing canvas.toBlob then readAsArrayBuffer, and then am trying to attach that buffer. However if the image is bigger then 200x200px then the post data is corrupt for some reason. :(
Comment 21•9 years ago
|
||
Oops forgot to need info. Need info'ing Tim - hey tim, a couple of us can't figure out how to make the arraybuffer alternative work without the size issues. Can you please share with us the alternative to mozFetchAsStream, we are using it with loadOneTab so it has to be a stream.
Thanks
Flags: needinfo?(ttaubert)
Assignee | ||
Comment 22•9 years ago
|
||
Sorry, I don't know enough about our streams interfaces to be helpful here. I forgot most of what was needed to introduce mozFetchAsStream() in those years in between.
Flags: needinfo?(ttaubert)
Comment 23•9 years ago
|
||
(In reply to Tim Taubert [:ttaubert] from comment #22)
> Sorry, I don't know enough about our streams interfaces to be helpful here.
> I forgot most of what was needed to introduce mozFetchAsStream() in those
> years in between.
Aw darn no problem. Thanks for the reply. Isn't it not appropriate to deprecate things that have no alternatives? Especially in the docs when I deprecate stuff I link out the alternative. So should we leave this bug open till someone can provide an alternative solution to get data from canvas to stream in the docs?
You need to log in
before you can comment on or make changes to this bug.
Description
•