The default bug view has changed. See this FAQ.

Method ctx.putImageData not working in firefox 16,17 if an invalid number of arguments is passed in

RESOLVED FIXED

Status

()

Core
DOM
RESOLVED FIXED
5 years ago
2 years ago

People

(Reporter: Internauta1024A, Unassigned)

Tracking

({addon-compat, dev-doc-complete, regression})

16 Branch
x86
All
addon-compat, dev-doc-complete, regression
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite ?

Firefox Tracking Flags

(firefox16+ fixed, firefox17+ fixed)

Details

(Whiteboard: [qa-])

Attachments

(2 attachments)

(Reporter)

Description

5 years ago
Method ctx.putImageData from chrome code not working in Firefox 16 (for extensions).
Error console return message:
Błąd: NS_ERROR_NOT_IMPLEMENTED: Component returned failure code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED) [nsIDOMCanvasRenderingContext2D.putImageData]
Plik źródłowy: chrome://foxfiltre/content/foxfiltreOverlay.js
Wiersz: 40

Example extensions with this problem:
https://addons.mozilla.org/en-us/firefox/addon/foxfiltre/
https://addons.mozilla.org/en-us/firefox/addon/anaglyph-3d/

Comment 1

5 years ago
I installed the add-on Anaglyh 3D but I don't see this error message in the error console.
Can you provide steps to reproduce this issue with Anaglyph 3D?
(Reporter)

Comment 2

5 years ago
Please open context menu on any website with images or any image in Firefox 16.*.
From context menu please select menu"Image 3D" or "Images 3D" and choose any submenu option(Color (red,cyan),Black-white (red,cyan),Black-white (red, green),Color (all images, red,cyan),Black-white (all images, red,cyan),Black-white (all images, red,green)) .

Comment 3

5 years ago
I tried with this JPEG http://i.imgur.com/ZRNoD.jpg but I don't see any error message in the console. Have you already modified your add-on Anaglyph 3D to add a workaround?
(Reporter)

Comment 4

5 years ago
Created attachment 642197 [details]
Image - error console Firefox16.* Linux version
(Reporter)

Comment 5

5 years ago
Created attachment 642198 [details]
Image - error console Firefox16.* Windows version (run in Wine on Linux)
(Reporter)

Updated

5 years ago
Attachment #642197 - Attachment description: Image error console Firefox16.* Linux → Image - error console Firefox16.* Linux version
(Reporter)

Comment 6

5 years ago
I don't have any idea how do it.
(Reporter)

Comment 7

5 years ago
(In reply to Loic from comment #3)
> I tried with this JPEG http://i.imgur.com/ZRNoD.jpg but I don't see any
> error message in the console. Have you already modified your add-on Anaglyph
> 3D to add a workaround?

I don't have any idea how do it.

Comment 8

5 years ago
I tried on Win 7 with Anaglyph 3D, I'm not able to reproduce the error message.
Try with a new fresh profile then reinstall the add-on.
Maybe the issue is only on Linux.
(Reporter)

Comment 9

5 years ago
In new profile this problem also exist (Firefox16.*(Nightly)).

In oldest Firefox version problem not exist(Stable and Aurora - new and old Firefox profile).

Comment 10

5 years ago
Win 7 + FF16 + Anaglyph 3D + fresh profile = no error message.
(Reporter)

Comment 11

5 years ago
(In reply to Loic from comment #10)
> Win 7 + FF16 + Anaglyph 3D + fresh profile = no error message.

Extension work correctly?Result image is anaglyph?

Comment 12

5 years ago
(In reply to Internauta1024A from comment #11)
> (In reply to Loic from comment #10)
> > Win 7 + FF16 + Anaglyph 3D + fresh profile = no error message.
> 
> Extension work correctly?Result image is anaglyph?

Yes, check the screenshot: http://i.imgur.com/P7pay.jpg (pictures in the order of the add-on options)
(Reporter)

Comment 13

5 years ago
(In reply to Loic from comment #12)
> (In reply to Internauta1024A from comment #11)
> > (In reply to Loic from comment #10)
> > > Win 7 + FF16 + Anaglyph 3D + fresh profile = no error message.
> > 
> > Extension work correctly?Result image is anaglyph?
> 
> Yes, check the screenshot: http://i.imgur.com/P7pay.jpg (pictures in the
> order of the add-on options)

Probably problem exist only on Linux.
Thank you for this suggestion and for testing this problem.
OS: All → Linux

Comment 14

5 years ago
It look similar to mine https://bugzilla.mozilla.org/show_bug.cgi?id=778128

Comment 15

5 years ago
Okay, I tried with your add-on Foxfiltre and I found 3 regressions with 3 differents error messages.

-- 1st regression:

Error: NS_ERROR_NOT_IMPLEMENTED: Component returned failure code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED) [nsIDOMCanvasRenderingContext2D.putImageData]
Source File: chrome://foxfiltre/content/foxfiltreOverlay.js
Line: 5096

m-c
good=2012-06-20
bad=2012-06-21
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=83369c1bb9af&tochange=6e828a4d1348

Suspected bugs:
Peter Van der Beken — Fix for bug 762657 (Fix canvas tests and drop support for fake ImageData in putImageData to comply with spec). r=Ms2ger.
Peter Van der Beken — Fix for bug 762651 (Add wrappercache to CanvasRenderingContext2D). r=bz.

-- 2nd regression:

Error: NS_ERROR_XPC_NOT_ENOUGH_ARGS: Not enough arguments
Source File: chrome://foxfiltre/content/foxfiltreOverlay.js
Line: 5096

m-c
good=2012-06-30
bad=2012-07-01
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=f08d285b63b0&tochange=d9d61d199b11

Suspected bug:
Peter Van der Beken — Fix for bug 762652 (Add the new DOM bindings API to CanvasRenderingContext2D). r=bz.

-- 3rd regression (not sure if the real one, maybe the error message has just changed)

Error: TypeError: Not enough arguments to CanvasRenderingContext2D.putImageData.
Source File: chrome://foxfiltre/content/foxfiltreOverlay.js
Line: 5096

m-c
good=2012-07-18
bad=2012-07-19
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=ae22909cef5a&tochange=6d8456a77e57
Status: UNCONFIRMED → NEW
Component: General → DOM
Ever confirmed: true
Keywords: regression
Product: Firefox → Core

Updated

5 years ago
Blocks: 778128
> -- 1st regression:

Line 5096 of foxfiltreOverlay.js is:

	ctx.putImageData(image, 0, 0,c.width,c.height)

Per spec, there are two possible ways to call putImageData: with 3 arguments (imagedata and x/y location) and with 7 arguments (imagedata, x/y location, x/y/width/height source rect).

The above call has _5_ arguments, so is not a valid call per spec.  When we updated to the spec in bug 762657, we stopped allowing such invalid calls.

> -- 2nd regression:

This was just a change in the error message due to the switch to new bindings in bug 762652.  The invalid call remained invalid and continued to throw.

> -- 3rd regression

Again, just a change in the error message for the invalid call.

Requesting tracking, since this is technically a regression, but as far as I can tell the only ways to fix this are:

1)  The addon is fixed to follow the spec.
2)  The spec gets changed to allow a 4-argument form of putImageData (doing what?)
3)  We go back to not following the spec.

My vote is on 3 not being the solution, for obvious reasons.  ;)
Blocks: 762657
tracking-firefox16: --- → ?
tracking-firefox17: --- → ?
Keywords: addon-compat
Summary: Method ctx.putImageData from chrome code not working in firefox 16. → Method ctx.putImageData not working in firefox 16 if an invalid number of arguments is passed in
No longer blocks: 778128
(Reporter)

Comment 17

5 years ago
With correctly number of arguments (ctx.putImageData(image, 0,0,0,0,c.width,c.height) and ctx.putImageData(image, 0,0))extension also return error:
NS_ERROR_NOT_IMPLEMENTED: Component returned failure code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED) [nsIDOMCanvasRenderingContext2D.putImageData]
.
(Reporter)

Updated

5 years ago
Summary: Method ctx.putImageData not working in firefox 16 if an invalid number of arguments is passed in → Method ctx.putImageData not working in firefox 16,17 if an invalid number of arguments is passed in
For comment 17, is the extension trying to write to a non-chrome canvas?
(Reporter)

Comment 19

5 years ago
How create non-chrome canvas in extension code?
Current code (create chrome canvas):
c = gBrowser.contentDocument.createElement("canvas")
gBrowser.contentDocument.body.appendChild(c)
> Current code (create chrome canvas):
> c = gBrowser.contentDocument.createElement("canvas")

That's creating a non-chrome canvas.  In particular, one belonging to whatever page is in gBrowser's selected tab at the moment.  If you're doing that, then you'll hit bug 778128.

If you want a chrome canvas, just replace that part with:

  document.createElement("canvas")

but since you're putting it into the web page afterward, it sounds like you do really want a canvas associated with that web page...
Depends on: 778128
Including Jorge here to see if we can get a handle on the number of affected add-ons, so that we can reason about whether only doing outreach is possible, per comment 16.
The add-ons MXR shows several uses of this function, but pretty much all of them use the 3 argument version, which shouldn't break according to comment #16. I think this is something that we should add to the compat docs, but I don't think more action is required.
(Reporter)

Comment 23

5 years ago
(In reply to Loic from comment #15)
> Okay, I tried with your add-on Foxfiltre and I found 3 regressions with 3
> differents error messages.
> 
> -- 1st regression:
> 
> Error: NS_ERROR_NOT_IMPLEMENTED: Component returned failure code: 0x80004001
> (NS_ERROR_NOT_IMPLEMENTED) [nsIDOMCanvasRenderingContext2D.putImageData]

This error exist on Windows?

Comment 24

5 years ago
(In reply to Internauta1024A from comment #23)
> (In reply to Loic from comment #15)
> > Okay, I tried with your add-on Foxfiltre and I found 3 regressions with 3
> > differents error messages.
> > 
> > -- 1st regression:
> > 
> > Error: NS_ERROR_NOT_IMPLEMENTED: Component returned failure code: 0x80004001
> > (NS_ERROR_NOT_IMPLEMENTED) [nsIDOMCanvasRenderingContext2D.putImageData]
> 
> This error exist on Windows?

You can see #778128  https://bugzilla.mozilla.org/show_bug.cgi?id=778128#c9 comment9 778128#c9

Comment 25

5 years ago
Yes, all the tests I did are with nightlies on Win 7.
(Reporter)

Updated

5 years ago
OS: Linux → All
(Reporter)

Comment 26

5 years ago
(In reply to Loic from comment #25)
> Yes, all the tests I did are with nightlies on Win 7.

Ok,thanks for this information.
(Reporter)

Comment 27

5 years ago
(In reply to Jorge Villalobos [:jorgev] from comment #22)
> The add-ons MXR shows several uses of this function, but pretty much all of
> them use the 3 argument version, which shouldn't break according to comment
> #16. I think this is something that we should add to the compat docs, but I
> don't think more action is required.

I ask for links for those addons.
(Reporter)

Comment 28

5 years ago
In Firefox 17.0a1 (2012-08-01) buildID- 20120801030520 extensions working correctly.
Thanks all commentators for help.
(Reporter)

Comment 29

5 years ago
In Aurora 16.0a2 (2012-07-31) - build 20120731042010 method ctx.putImageData not working .
Bug 778128 hasn't landed on Aurora yet.  Once it does, things should work.
(Reporter)

Comment 31

5 years ago
(In reply to Boris Zbarsky (:bz) [In and out Aug 1 - 10, out Aug 11-20] from comment #30)
> Bug 778128 hasn't landed on Aurora yet.  Once it does, things should work.

Thanks for this information.
Just approved bug 778128 for aurora, Jorge does a bug need to be filed to add the information to the docs?
tracking-firefox16: ? → +
tracking-firefox17: ? → +
No, the keywords should suffice.
Keywords: dev-doc-needed
(Reporter)

Comment 34

5 years ago
In Firefox 16.0a2 (current build) method ctx.putImageData also working correctly.
Thanks all commentators for help.
Given Comment 32 and 34, this should now be fixed.
Status: NEW → RESOLVED
Last Resolved: 5 years ago
status-firefox16: --- → fixed
status-firefox17: --- → fixed
Resolution: --- → FIXED

Updated

5 years ago
Flags: in-testsuite?
Internauta1024A, please verify that this is now fixed with Firefox 16.0.1 and 17.0 beta, thanks.
Whiteboard: [qa-]
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D.putImageData#Compatibility_notes
Keywords: dev-doc-needed → dev-doc-complete
You need to log in before you can comment on or make changes to this bug.