Closed Bug 773545 Opened 12 years ago Closed 12 years ago

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

Categories

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

16 Branch
x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
firefox16 + fixed
firefox17 + fixed

People

(Reporter: internauta1024a, Unassigned)

References

Details

(Keywords: addon-compat, dev-doc-complete, regression, Whiteboard: [qa-])

Attachments

(2 files)

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/
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?
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)) .
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?
Attachment #642197 - Attachment description: Image error console Firefox16.* Linux → Image - error console Firefox16.* Linux version
I don't have any idea how do it.
(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.
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.
In new profile this problem also exist (Firefox16.*(Nightly)).

In oldest Firefox version problem not exist(Stable and Aurora - new and old Firefox profile).
Win 7 + FF16 + Anaglyph 3D + fresh profile = no error message.
(In reply to Loic from comment #10)
> Win 7 + FF16 + Anaglyph 3D + fresh profile = no error message.

Extension work correctly?Result image is anaglyph?
(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)
(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
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
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
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
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]
.
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?
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.
(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?
(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
Yes, all the tests I did are with nightlies on Win 7.
OS: Linux → All
(In reply to Loic from comment #25)
> Yes, all the tests I did are with nightlies on Win 7.

Ok,thanks for this information.
(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.
In Firefox 17.0a1 (2012-08-01) buildID- 20120801030520 extensions working correctly.
Thanks all commentators for help.
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.
(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?
No, the keywords should suffice.
Keywords: dev-doc-needed
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
Closed: 12 years ago
Resolution: --- → FIXED
Flags: in-testsuite?
Internauta1024A, please verify that this is now fixed with Firefox 16.0.1 and 17.0 beta, thanks.
Whiteboard: [qa-]
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: