diff options
17 files changed, 23 insertions, 32 deletions
diff --git a/components/script/dom/offscreencanvas.rs b/components/script/dom/offscreencanvas.rs index d820149a7b0..2be33688afc 100644 --- a/components/script/dom/offscreencanvas.rs +++ b/components/script/dom/offscreencanvas.rs @@ -15,7 +15,7 @@ use crate::dom::bindings::cell::{ref_filter_map, DomRefCell, Ref}; use crate::dom::bindings::codegen::Bindings::OffscreenCanvasBinding::{ OffscreenCanvasMethods, OffscreenRenderingContext, }; -use crate::dom::bindings::error::Fallible; +use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomObject}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; @@ -157,18 +157,20 @@ impl OffscreenCanvasMethods for OffscreenCanvas { _cx: JSContext, id: DOMString, _options: HandleValue, - ) -> Option<OffscreenRenderingContext> { + ) -> Fallible<Option<OffscreenRenderingContext>> { match &*id { - "2d" => self + "2d" => Ok(self .get_or_init_2d_context() - .map(OffscreenRenderingContext::OffscreenCanvasRenderingContext2D), + .map(OffscreenRenderingContext::OffscreenCanvasRenderingContext2D)), /*"webgl" | "experimental-webgl" => self .get_or_init_webgl_context(cx, options) .map(OffscreenRenderingContext::WebGLRenderingContext), "webgl2" | "experimental-webgl2" => self .get_or_init_webgl2_context(cx, options) .map(OffscreenRenderingContext::WebGL2RenderingContext),*/ - _ => None, + _ => Err(Error::Type(String::from( + "Unrecognized OffscreenCanvas context type", + ))), } } diff --git a/components/script/dom/webidls/OffscreenCanvas.webidl b/components/script/dom/webidls/OffscreenCanvas.webidl index 110af8a8f99..04c28f989a5 100644 --- a/components/script/dom/webidls/OffscreenCanvas.webidl +++ b/components/script/dom/webidls/OffscreenCanvas.webidl @@ -19,7 +19,7 @@ interface OffscreenCanvas : EventTarget { attribute [EnforceRange] unsigned long long width; attribute [EnforceRange] unsigned long long height; - OffscreenRenderingContext? getContext(DOMString contextId, optional any options = null); + [Throws] OffscreenRenderingContext? getContext(DOMString contextId, optional any options = null); //ImageBitmap transferToImageBitmap(); //Promise<Blob> convertToBlob(optional ImageEncodeOptions options); }; diff --git a/tests/wpt/meta/html/canvas/offscreen/canvas-context/2d.canvas.context.casesensitive.html.ini b/tests/wpt/meta/html/canvas/offscreen/canvas-context/2d.canvas.context.casesensitive.html.ini deleted file mode 100644 index 64e281aae16..00000000000 --- a/tests/wpt/meta/html/canvas/offscreen/canvas-context/2d.canvas.context.casesensitive.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[2d.canvas.context.casesensitive.html] - [Context name "2D" is unrecognised; matching is case sensitive] - expected: FAIL diff --git a/tests/wpt/meta/html/canvas/offscreen/canvas-context/2d.canvas.context.casesensitive.worker.js.ini b/tests/wpt/meta/html/canvas/offscreen/canvas-context/2d.canvas.context.casesensitive.worker.js.ini deleted file mode 100644 index 27e9dca7c02..00000000000 --- a/tests/wpt/meta/html/canvas/offscreen/canvas-context/2d.canvas.context.casesensitive.worker.js.ini +++ /dev/null @@ -1,3 +0,0 @@ -[2d.canvas.context.casesensitive.worker.html] - [Context name "2D" is unrecognised; matching is case sensitive] - expected: FAIL diff --git a/tests/wpt/meta/html/canvas/offscreen/canvas-context/2d.canvas.context.emptystring.html.ini b/tests/wpt/meta/html/canvas/offscreen/canvas-context/2d.canvas.context.emptystring.html.ini deleted file mode 100644 index 2c3eefedcd0..00000000000 --- a/tests/wpt/meta/html/canvas/offscreen/canvas-context/2d.canvas.context.emptystring.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[2d.canvas.context.emptystring.html] - [getContext with empty string returns null] - expected: FAIL diff --git a/tests/wpt/meta/html/canvas/offscreen/canvas-context/2d.canvas.context.emptystring.worker.js.ini b/tests/wpt/meta/html/canvas/offscreen/canvas-context/2d.canvas.context.emptystring.worker.js.ini deleted file mode 100644 index cc368ac511e..00000000000 --- a/tests/wpt/meta/html/canvas/offscreen/canvas-context/2d.canvas.context.emptystring.worker.js.ini +++ /dev/null @@ -1,3 +0,0 @@ -[2d.canvas.context.emptystring.worker.html] - [getContext with empty string returns null] - expected: FAIL diff --git a/tests/wpt/meta/html/canvas/offscreen/canvas-context/2d.canvas.context.invalid.args.html.ini b/tests/wpt/meta/html/canvas/offscreen/canvas-context/2d.canvas.context.invalid.args.html.ini deleted file mode 100644 index b942e4f7dc2..00000000000 --- a/tests/wpt/meta/html/canvas/offscreen/canvas-context/2d.canvas.context.invalid.args.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[2d.canvas.context.invalid.args.html] - [Calling getContext with invalid arguments.] - expected: FAIL diff --git a/tests/wpt/meta/html/canvas/offscreen/canvas-context/2d.canvas.context.invalid.args.worker.js.ini b/tests/wpt/meta/html/canvas/offscreen/canvas-context/2d.canvas.context.invalid.args.worker.js.ini deleted file mode 100644 index cb833a67760..00000000000 --- a/tests/wpt/meta/html/canvas/offscreen/canvas-context/2d.canvas.context.invalid.args.worker.js.ini +++ /dev/null @@ -1,3 +0,0 @@ -[2d.canvas.context.invalid.args.worker.html] - [Calling getContext with invalid arguments.] - expected: FAIL diff --git a/tests/wpt/meta/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext.html.ini b/tests/wpt/meta/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext.html.ini index 44861ea868c..0ef32f676fc 100644 --- a/tests/wpt/meta/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext.html.ini +++ b/tests/wpt/meta/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext.html.ini @@ -5,9 +5,6 @@ [Test that webglcontext.canvas should return the original OffscreenCanvas] expected: FAIL - [Test that getContext with un-supported string throws a TypeError.] - expected: FAIL - [Test that OffscreenCanvasRenderingContext2D with alpha disabled makes the OffscreenCanvas opaque] expected: FAIL diff --git a/tests/wpt/meta/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext.worker.js.ini b/tests/wpt/meta/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext.worker.js.ini index 731fa902899..54b6ae58825 100644 --- a/tests/wpt/meta/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext.worker.js.ini +++ b/tests/wpt/meta/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext.worker.js.ini @@ -5,9 +5,6 @@ [Test that webglcontext.canvas should return the original OffscreenCanvas] expected: FAIL - [Test that getContext with un-supported string throws a TypeError.] - expected: FAIL - [Test that OffscreenCanvasRenderingContext2D with alpha disabled makes the OffscreenCanvas opaque] expected: FAIL diff --git a/tests/wpt/webgl/meta/conformance/offscreencanvas/context-creation-worker.html.ini b/tests/wpt/webgl/meta/conformance/offscreencanvas/context-creation-worker.html.ini index ee357efcfda..2ab0fabddae 100644 --- a/tests/wpt/webgl/meta/conformance/offscreencanvas/context-creation-worker.html.ini +++ b/tests/wpt/webgl/meta/conformance/offscreencanvas/context-creation-worker.html.ini @@ -1,3 +1,4 @@ [context-creation-worker.html] + expected: ERROR [WebGL test #0: Some tests failed] expected: FAIL diff --git a/tests/wpt/webgl/meta/conformance/offscreencanvas/context-creation.html.ini b/tests/wpt/webgl/meta/conformance/offscreencanvas/context-creation.html.ini index a96eefc2051..acc65e83166 100644 --- a/tests/wpt/webgl/meta/conformance/offscreencanvas/context-creation.html.ini +++ b/tests/wpt/webgl/meta/conformance/offscreencanvas/context-creation.html.ini @@ -1,4 +1,7 @@ [context-creation.html] + expected: ERROR [WebGL test #0: WebGL context creation failed] expected: FAIL + [WebGL test #0: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).] + expected: FAIL diff --git a/tests/wpt/webgl/meta/conformance/offscreencanvas/methods-worker.html.ini b/tests/wpt/webgl/meta/conformance/offscreencanvas/methods-worker.html.ini index 9e9e93032ca..bfddcc0627d 100644 --- a/tests/wpt/webgl/meta/conformance/offscreencanvas/methods-worker.html.ini +++ b/tests/wpt/webgl/meta/conformance/offscreencanvas/methods-worker.html.ini @@ -1,4 +1,4 @@ [methods-worker.html] + expected: ERROR [WebGL test #0: Some tests failed] expected: FAIL - diff --git a/tests/wpt/webgl/meta/conformance/offscreencanvas/methods.html.ini b/tests/wpt/webgl/meta/conformance/offscreencanvas/methods.html.ini index 56c64a49d8e..8fb38b1904a 100644 --- a/tests/wpt/webgl/meta/conformance/offscreencanvas/methods.html.ini +++ b/tests/wpt/webgl/meta/conformance/offscreencanvas/methods.html.ini @@ -1,4 +1,7 @@ [methods.html] + expected: ERROR [WebGL test #0: Some WebGL methods not found] expected: FAIL + [WebGL test #0: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).] + expected: FAIL diff --git a/tests/wpt/webgl/meta/conformance2/offscreencanvas/context-creation.html.ini b/tests/wpt/webgl/meta/conformance2/offscreencanvas/context-creation.html.ini index c6895c973cc..bb11cb3fbd0 100644 --- a/tests/wpt/webgl/meta/conformance2/offscreencanvas/context-creation.html.ini +++ b/tests/wpt/webgl/meta/conformance2/offscreencanvas/context-creation.html.ini @@ -1,4 +1,7 @@ [context-creation.html] + expected: ERROR [WebGL test #0: WebGL2 context creation failed] expected: FAIL + [WebGL test #0: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).] + expected: FAIL diff --git a/tests/wpt/webgl/meta/conformance2/offscreencanvas/methods-2-worker.html.ini b/tests/wpt/webgl/meta/conformance2/offscreencanvas/methods-2-worker.html.ini index 9ec07aa9bdd..996889b6d2d 100644 --- a/tests/wpt/webgl/meta/conformance2/offscreencanvas/methods-2-worker.html.ini +++ b/tests/wpt/webgl/meta/conformance2/offscreencanvas/methods-2-worker.html.ini @@ -1,4 +1,4 @@ [methods-2-worker.html] + expected: ERROR [WebGL test #0: Some tests failed] expected: FAIL - diff --git a/tests/wpt/webgl/meta/conformance2/offscreencanvas/methods-2.html.ini b/tests/wpt/webgl/meta/conformance2/offscreencanvas/methods-2.html.ini index d49a3a486e5..a7eb7244f59 100644 --- a/tests/wpt/webgl/meta/conformance2/offscreencanvas/methods-2.html.ini +++ b/tests/wpt/webgl/meta/conformance2/offscreencanvas/methods-2.html.ini @@ -1,4 +1,7 @@ [methods-2.html] + expected: ERROR [WebGL test #0: Some WebGL2 methods not found] expected: FAIL + [WebGL test #0: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).] + expected: FAIL |