Last Comment Bug 773545 - Method ctx.putImageData not working in firefox 16,17 if an invalid number of arguments is passed in
: Method ctx.putImageData not working in firefox 16,17 if an invalid number of ...
Status: RESOLVED FIXED
[qa-]
: addon-compat, dev-doc-complete, regression
Product: Core
Classification: Components
Component: DOM (show other bugs)
: 16 Branch
: x86 All
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on: 778128
Blocks: 762657
  Show dependency treegraph
 
Reported: 2012-07-12 23:28 PDT by Internauta1024A
Modified: 2014-11-25 13:01 PST (History)
10 users (show)
Ms2ger: in‑testsuite?
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
+
fixed
+
fixed


Attachments
Image - error console Firefox16.* Linux version (27.25 KB, image/png)
2012-07-14 02:31 PDT, Internauta1024A
no flags Details
Image - error console Firefox16.* Windows version (run in Wine on Linux) (28.20 KB, image/png)
2012-07-14 02:34 PDT, Internauta1024A
no flags Details

Description Internauta1024A 2012-07-12 23:28:23 PDT
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 Loic 2012-07-13 02:03:31 PDT
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?
Comment 2 Internauta1024A 2012-07-13 02:34:35 PDT
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 Loic 2012-07-13 04:01:06 PDT
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?
Comment 4 Internauta1024A 2012-07-14 02:31:36 PDT
Created attachment 642197 [details]
Image - error console Firefox16.* Linux version
Comment 5 Internauta1024A 2012-07-14 02:34:55 PDT
Created attachment 642198 [details]
Image - error console Firefox16.* Windows version (run in Wine on Linux)
Comment 6 Internauta1024A 2012-07-14 02:40:25 PDT
I don't have any idea how do it.
Comment 7 Internauta1024A 2012-07-14 02:42:37 PDT
(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 Loic 2012-07-14 03:26:03 PDT
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.
Comment 9 Internauta1024A 2012-07-15 06:38:04 PDT
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 Loic 2012-07-15 10:34:50 PDT
Win 7 + FF16 + Anaglyph 3D + fresh profile = no error message.
Comment 11 Internauta1024A 2012-07-17 01:38:10 PDT
(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 Loic 2012-07-17 02:23:04 PDT
(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)
Comment 13 Internauta1024A 2012-07-17 02:56:09 PDT
(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.
Comment 14 Thomasy 2012-07-28 10:50:50 PDT
It look similar to mine https://bugzilla.mozilla.org/show_bug.cgi?id=778128
Comment 15 Loic 2012-07-28 16:55:56 PDT
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
Comment 16 Boris Zbarsky [:bz] 2012-07-28 19:03:46 PDT
> -- 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.  ;)
Comment 17 Internauta1024A 2012-07-29 23:15:33 PDT
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]
.
Comment 18 Boris Zbarsky [:bz] 2012-07-30 00:48:10 PDT
For comment 17, is the extension trying to write to a non-chrome canvas?
Comment 19 Internauta1024A 2012-07-30 01:19:08 PDT
How create non-chrome canvas in extension code?
Current code (create chrome canvas):
c = gBrowser.contentDocument.createElement("canvas")
gBrowser.contentDocument.body.appendChild(c)
Comment 20 Boris Zbarsky [:bz] 2012-07-30 01:24:51 PDT
> 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...
Comment 21 Alex Keybl [:akeybl] 2012-07-30 09:47:23 PDT
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.
Comment 22 Jorge Villalobos [:jorgev] 2012-07-30 12:35:04 PDT
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.
Comment 23 Internauta1024A 2012-07-30 22:01:16 PDT
(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 Thomasy 2012-07-30 22:08:22 PDT
(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 Loic 2012-07-31 02:23:43 PDT
Yes, all the tests I did are with nightlies on Win 7.
Comment 26 Internauta1024A 2012-07-31 23:20:28 PDT
(In reply to Loic from comment #25)
> Yes, all the tests I did are with nightlies on Win 7.

Ok,thanks for this information.
Comment 27 Internauta1024A 2012-07-31 23:22:31 PDT
(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.
Comment 28 Internauta1024A 2012-08-01 05:27:03 PDT
In Firefox 17.0a1 (2012-08-01) buildID- 20120801030520 extensions working correctly.
Thanks all commentators for help.
Comment 29 Internauta1024A 2012-08-01 05:34:55 PDT
In Aurora 16.0a2 (2012-07-31) - build 20120731042010 method ctx.putImageData not working .
Comment 30 Boris Zbarsky [:bz] 2012-08-01 07:07:57 PDT
Bug 778128 hasn't landed on Aurora yet.  Once it does, things should work.
Comment 31 Internauta1024A 2012-08-01 07:56:17 PDT
(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.
Comment 32 Lukas Blakk [:lsblakk] use ?needinfo 2012-08-01 17:25:56 PDT
Just approved bug 778128 for aurora, Jorge does a bug need to be filed to add the information to the docs?
Comment 33 Jorge Villalobos [:jorgev] 2012-08-03 09:40:36 PDT
No, the keywords should suffice.
Comment 34 Internauta1024A 2012-08-05 09:18:04 PDT
In Firefox 16.0a2 (current build) method ctx.putImageData also working correctly.
Thanks all commentators for help.
Comment 35 Alex Keybl [:akeybl] 2012-08-22 17:28:09 PDT
Given Comment 32 and 34, this should now be fixed.
Comment 36 Anthony Hughes (:ashughes) [GFX][QA][Mentor] 2012-10-16 16:02:25 PDT
Internauta1024A, please verify that this is now fixed with Firefox 16.0.1 and 17.0 beta, thanks.

Note You need to log in before you can comment on or make changes to this bug.