Closed
Bug 718655
Opened 12 years ago
Closed 12 years ago
HTML5 canvas getImageData in addon will have exception
Categories
(Core :: XPConnect, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: admin, Unassigned)
Details
Attachments
(1 file)
3.39 KB,
application/octet-stream
|
Details |
User Agent: Mozilla/5.0 (Ubuntu; X11; Linux i686; rv:9.0.1) Gecko/20100101 Firefox/9.0.1 Build ID: 20111228084953 Steps to reproduce: I do some image filter on page hxxp://portal.nctu.edu.tw/ It work using firebug console but fall in addon page-mod content scripts var captcha = document.getElementById('captcha'); var canvas = document.createElement("canvas"); var seccode = document.getElementById('seccode'); canvas.id = "canvas"; canvas.sytle = "z-index: 9999;"; if (seccode != null) { document.getElementById('seccode').parentNode.appendChild(canvas); if (canvas.getContext) { var context = canvas.getContext('2d'); if (captcha != null) { context.drawImage(captcha, 0, 0); var threshold = 65; console.log(captcha.width + "," + captcha.height); var canvasData = context.getImageData(0, 0, captcha.width, captcha.height); if (canvasData == null) { console.log(" canvasData is null "); } console.log("saadsasd"); if (canvasData.data == null) { console.log(" canvasData.data is null "); } var d = canvasData.data; console.log(d.length); for (var i = 0; i < d.length; i += 4) { //for (var i = 0; i < d.length; i += 4) { var r = d[i]; var g = d[i + 1]; var b = d[i + 2]; var v = (0.2126 * r + 0.7152 * g + 0.0722 * b >= threshold) ? 255 : 0; d[i] = v; d[i + 1] = v; d[i + 2] = v; } context.putImageData(canvasData, 0, 0); } } } HTML5 Image filter in addon will have the following exception Actual results: error: An exception occurred. Traceback (most recent call last): File "resource://jid1-kpgzz5f0jye5aa-at-jetpack-api-utils-lib/content/content-proxy.js", line 718, in return wrap(o, obj, name); File "resource://jid1-kpgzz5f0jye5aa-at-jetpack-api-utils-lib/content/content-proxy.js", line 254, in wrap return getProxyForObject(value); File "resource://jid1-kpgzz5f0jye5aa-at-jetpack-api-utils-lib/content/content-proxy.js", line 297, in getProxyForObject configurable : false}); TypeError: Object.defineProperty(obj, "___proxy", {value: proxy, writable: false, enumerable: false, configurable: false}) is not extensible OK Expected results: It should filter the image correctly without any exception
Updated•12 years ago
|
Component: Untriaged → Canvas: 2D
Product: Firefox → Core
QA Contact: untriaged → canvas.2d
Comment 2•12 years ago
|
||
This doesn't seem to have anything to do with canvas; none of the code cited as throwing in comment 0 is canvas-related. An actual way to reproduce this would be useful, but at first glance this seems like either an xpconnect bug or an addons-sdk bug...
Component: Canvas: 2D → XPConnect
QA Contact: canvas.2d → xpconnect
I found it is addon sdk relatted and it is fixed version in 1.4
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•