Closed
Bug 645792
Opened 14 years ago
Closed 11 years ago
Implement correct behavior for getContext() failures
Categories
(Core :: Graphics: CanvasWebGL, defect)
Tracking
()
RESOLVED
FIXED
mozilla26
People
(Reporter: bjacob, Unassigned)
References
Details
(Whiteboard: webgl-conformance webgl-next)
Attachments
(1 file, 1 obsolete file)
3.49 KB,
patch
|
bjacob
:
review+
|
Details | Diff | Splinter Review |
We shoud:
* return null and NOT generate an exception
* generate a webglcontextcreationerror event
As per the spec:
http://www.khronos.org/registry/webgl/specs/latest/#5.14.3
Quote:
webglcontextcreationerror
This event occurs in response to a call to getContext() on the HTMLCanvasElement receiving the event, when some error occurs during that call. When such an error occurs the getContext() returns with a null value. Later, at the normal event delivery time, this event is delivered with the details of the failure. If the HTMLCanvasElement is listening for this event, it will be delivered whenever getContext() returns null.
The statusMessage attribute may contain a platform dependent string about the nature of the failure.
Reporter | ||
Comment 1•13 years ago
|
||
I don't remember what the current status is, on whether we should generate an exception or not. Checking that is the first step here. http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-canvas-getcontext
Reporter | ||
Updated•13 years ago
|
Whiteboard: webgl-conformance webgl-next
Comment 2•12 years ago
|
||
Similar issue:
https://bugzilla.mozilla.org/show_bug.cgi?id=844244
Comment 4•11 years ago
|
||
This appears to still be the case. I'm amused that the 1.0.1 conformance suite doesn't test this. (Nor 1.0.2, I believe)
Comment 5•11 years ago
|
||
I didn't find any test either.
I'm looking at the code in question, it seams to be very old... So the question I'm asking is: should we get away from stuff like:
nsCOMPtr<nsICanvasRenderingContextInternal> ctx =
do_CreateInstance(ctxString.get(), &rv);
Should we re-write entirely HTMLCanvasElement::GetContextHelper and HTMLCanvasElement::GetContext?
Comment 6•11 years ago
|
||
Tested with a return false in WebGLContext::InitAndValidate and:
> function init() {
> outputInit();
>
> var renderingCanvas = document.getElementById("renderingZone");
>
> try
> {
> gl = renderingCanvas.getContext("experimental-webgl");
> }
> catch (exp)
> {
> outputPrint("Test failed");
> return;
> }
>
> outputPrint("Test passed");
> }
https://tbpl.mozilla.org/?tree=Try&rev=a19e6557d5f5
Attachment #796641 -
Flags: review?(bjacob)
Comment 7•11 years ago
|
||
This patch also fix unit tests using a try/catch in javascript.
Attachment #796641 -
Attachment is obsolete: true
Attachment #796641 -
Flags: review?(bjacob)
Attachment #796722 -
Flags: review?(bjacob)
Reporter | ||
Updated•11 years ago
|
Attachment #796722 -
Flags: review?(bjacob) → review+
Comment 9•11 years ago
|
||
Target Milestone: --- → mozilla26
Comment 10•11 years ago
|
||
Comment 11•11 years ago
|
||
The leaks weren't from this patch. Re-landed.
https://hg.mozilla.org/integration/mozilla-inbound/rev/13fc79f9c13a
Comment 12•11 years ago
|
||
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•