Closed
Bug 730554
Opened 13 years ago
Closed 13 years ago
Cleanup nsIDOMWebGLRenderingContext_Tex{,Sub}Image2D
Categories
(Core :: Graphics: CanvasWebGL, defect)
Core
Graphics: CanvasWebGL
Tracking
()
RESOLVED
FIXED
mozilla13
People
(Reporter: Ms2ger, Assigned: Ms2ger)
References
Details
(Whiteboard: [gfx.relnote.13])
Attachments
(3 files, 4 obsolete files)
|
11.40 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
|
12.58 KB,
patch
|
Details | Diff | Splinter Review | |
|
2.12 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
A lot of duplicated and not-very-well-written code here.
Attachment #600636 -
Flags: review?(bzbarsky)
| Assignee | ||
Comment 1•13 years ago
|
||
Apparently throwing twice on the same context isn't appreciated
Attachment #600637 -
Flags: review?(bzbarsky)
| Assignee | ||
Comment 2•13 years ago
|
||
This is basically the same as bug 706052, but it actually passes try.
Attachment #600638 -
Flags: review?(bzbarsky)
Comment 3•13 years ago
|
||
Comment on attachment 600638 [details] [diff] [review]
Part c: Unwrap to nsGenericElement
r=me
Attachment #600638 -
Flags: review?(bzbarsky) → review+
Comment 4•13 years ago
|
||
Comment on attachment 600636 [details] [diff] [review]
Part a: Deduplicate code
>+++ b/content/canvas/src/CustomQS_WebGL.h
>+ nsresult ImageData(WebGLsizei width, WebGLsizei height, JSObject* pixels)
Maybe call this TryImageData?
>+ nsresult Element(nsIDOMElement* elt)
And TryElement?
>+TexImage2DImageDataOrElement(JSContext* cx, T* self, JS::Value* object)
I'd prefer that |self| be a T& here, since it can't be null.
>+ // bail out immediately, don't try to interprete as ImageData
"interpret"
>+ // failed to interprete object as a DOMElement, now try to interprete it as ImageData
"interpret" twice
>+ if (!JS_ValueToECMAInt32(cx, js_width, &int_width) ||
>+ !JS_ValueToECMAInt32(cx, js_height, &int_height))
>+ {
>+ return NS_ERROR_FAILURE;
This is wrong, I think. The callee here can throw on cx, and then you'll attempt to throw as well when the error return is seen in the caller. Or am I missing something?
Attachment #600636 -
Flags: review?(bzbarsky) → review-
Comment 5•13 years ago
|
||
Comment on attachment 600637 [details] [diff] [review]
Part b: Check the result of JS_GetProperty
>+ if (!JS_GetProperty(cx, imageData, "width", &js_width) ||
>+ !JS_GetProperty(cx, imageData, "height", &js_height) ||
>+ !JS_GetProperty(cx, imageData, "data", &js_data) ||
...
> return NS_ERROR_FAILURE;
This has the same problem as part a, right?.
Attachment #600637 -
Flags: review?(bzbarsky) → review-
| Assignee | ||
Comment 6•13 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #4)
> Comment on attachment 600636 [details] [diff] [review]
> Part a: Deduplicate code
>
> >+++ b/content/canvas/src/CustomQS_WebGL.h
> >+ nsresult ImageData(WebGLsizei width, WebGLsizei height, JSObject* pixels)
>
> Maybe call this TryImageData?
>
> >+ nsresult Element(nsIDOMElement* elt)
>
> And TryElement?
Why's that?
Comment 7•13 years ago
|
||
Because that makes it clearer what it's doing?
| Assignee | ||
Comment 8•13 years ago
|
||
Doesn't really for me... Maybe something like DoCallForImageData?
Comment 9•13 years ago
|
||
That's fine too.
| Assignee | ||
Comment 10•13 years ago
|
||
Attachment #600636 -
Attachment is obsolete: true
Attachment #604645 -
Flags: review?(bzbarsky)
| Assignee | ||
Comment 11•13 years ago
|
||
Attachment #604646 -
Flags: review?(bzbarsky)
| Assignee | ||
Comment 12•13 years ago
|
||
Attachment #600637 -
Attachment is obsolete: true
Attachment #600638 -
Attachment is obsolete: true
| Assignee | ||
Comment 13•13 years ago
|
||
And this is why you got the reviews, btw :)
Comment 14•13 years ago
|
||
Comment on attachment 604645 [details] [diff] [review]
Part a: Deduplicate code (v2)
r=me
Attachment #604645 -
Flags: review?(bzbarsky) → review+
Comment 15•13 years ago
|
||
Comment on attachment 604646 [details] [diff] [review]
Part b: Check the result of JS_GetProperty (v2)
This is still trying to throw if JS_GetProperty returned false, but if it returned false it already threw....
Attachment #604646 -
Flags: review?(bzbarsky) → review-
| Assignee | ||
Comment 16•13 years ago
|
||
Er, indeed so. I was sure I fixed it.
Attachment #604646 -
Attachment is obsolete: true
Attachment #604649 -
Flags: review?(bzbarsky)
Comment 17•13 years ago
|
||
Comment on attachment 604649 [details] [diff] [review]
Part b: Check the result of JS_GetProperty (v3)
r=me
Attachment #604649 -
Flags: review?(bzbarsky) → review+
| Assignee | ||
Comment 18•13 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/7cf52fda8a40
https://hg.mozilla.org/mozilla-central/rev/975335c0de31
https://hg.mozilla.org/mozilla-central/rev/ff72521021c5
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla13
Updated•13 years ago
|
Whiteboard: [gfx.relnote.13]
You need to log in
before you can comment on or make changes to this bug.
Description
•