Diff
Modified: trunk/LayoutTests/ChangeLog (280083 => 280084)
--- trunk/LayoutTests/ChangeLog 2021-07-20 16:54:58 UTC (rev 280083)
+++ trunk/LayoutTests/ChangeLog 2021-07-20 17:07:58 UTC (rev 280084)
@@ -1,3 +1,14 @@
+2021-07-20 Chris Lord <[email protected]>
+
+ Canvas and OffscreenCanvas getContext should check if argument is an object before trying to convert it to a dictionary
+ https://bugs.webkit.org/show_bug.cgi?id=227792
+
+ Reviewed by Sam Weinig.
+
+ Canvas 2d getContext extraargs tests now pass.
+
+ * platform/glib/TestExpectations:
+
2021-07-20 Sam Sneddon <[email protected]>
Change referrer-policy default to strict-origin-when-cross-origin
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (280083 => 280084)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-07-20 16:54:58 UTC (rev 280083)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-07-20 17:07:58 UTC (rev 280084)
@@ -1,3 +1,49 @@
+2021-07-20 Chris Lord <[email protected]>
+
+ Canvas and OffscreenCanvas getContext should check if argument is an object before trying to convert it to a dictionary
+ https://bugs.webkit.org/show_bug.cgi?id=227792
+
+ Reviewed by Sam Weinig.
+
+ Synchronise with upstream WPT 2d canvas getContext tests.
+
+ * web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any-expected.txt: Added.
+ * web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.html: Added.
+ * web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.js: Added.
+ (test.const.options.get alpha):
+ (test.const.options.get willReadFrequently):
+ (test.const.options.get desynchronized):
+ (test.const.options.get colorSpace):
+ (test):
+ * web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.worker-expected.txt: Added.
+ * web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.worker.html: Added.
+ * web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs-expected.txt: Removed.
+ * web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache-expected.txt: Added.
+ * web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.html: Added.
+ * web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.worker-expected.txt: Added.
+ * web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.worker.html: Added.
+ * web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.worker.js: Added.
+ (t_fail.t.step_func):
+ (t.step):
+ * web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create-expected.txt: Added.
+ * web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.html: Added.
+ * web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.worker-expected.txt: Added.
+ * web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.worker.html: Added.
+ * web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.worker.js: Added.
+ (t_fail.t.step_func):
+ (t.step):
+ * web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.html: Removed.
+ * web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.worker-expected.txt: Removed.
+ * web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.worker.js: Removed.
+ * web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/w3c-import.log:
+ * web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d-getcontext-options-expected.txt: Added.
+ * web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d-getcontext-options.html: Added.
+ * web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.cache-expected.txt: Added.
+ * web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.cache.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.html.
+ * web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.create-expected.txt: Added.
+ * web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.create.html: Added.
+ * web-platform-tests/html/semantics/embedded-content/the-canvas-element/w3c-import.log:
+
2021-07-20 Sam Sneddon <[email protected]>
Change referrer-policy default to strict-origin-when-cross-origin
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any-expected.txt (0 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any-expected.txt 2021-07-20 17:07:58 UTC (rev 280084)
@@ -0,0 +1,3 @@
+
+FAIL 2d-getcontext-options assert_array_equals: order of operations (creation) lengths differ, expected array ["alpha", "colorSpace", "colorSpace toString", "desynchronized", "willReadFrequently"] length 5, got ["colorSpace", "colorSpace toString", "desynchronized"] length 3
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.html (0 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.html 2021-07-20 17:07:58 UTC (rev 280084)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.js (0 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.js (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.js 2021-07-20 17:07:58 UTC (rev 280084)
@@ -0,0 +1,40 @@
+test(() => {
+ const expected = [
+ "alpha",
+ "colorSpace",
+ "colorSpace toString",
+ "desynchronized",
+ "willReadFrequently",
+ ];
+ const actual = [];
+ const options = {
+ get alpha() {
+ actual.push("alpha");
+ return true;
+ },
+ get willReadFrequently() {
+ actual.push("willReadFrequently");
+ return false;
+ },
+ get desynchronized() {
+ actual.push("desynchronized");
+ return false;
+ },
+ get colorSpace() {
+ actual.push("colorSpace");
+ return {
+ toString() {
+ actual.push("colorSpace toString");
+ return "srgb";
+ }
+ };
+ },
+ };
+
+ const canvas = new OffscreenCanvas(100, 50);
+ const context = canvas.getContext('2d', options);
+ assert_not_equals(context, null, "context");
+ assert_array_equals(actual, expected, "order of operations (creation)");
+ assert_equals(canvas.getContext('2d', options), context, "cached context");
+ assert_array_equals(actual, expected, "order of operations (caching)");
+});
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.worker-expected.txt (0 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.worker-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.worker-expected.txt 2021-07-20 17:07:58 UTC (rev 280084)
@@ -0,0 +1,3 @@
+
+FAIL 2d-getcontext-options assert_array_equals: order of operations (creation) lengths differ, expected array ["alpha", "colorSpace", "colorSpace toString", "desynchronized", "willReadFrequently"] length 5, got ["colorSpace", "colorSpace toString", "desynchronized"] length 3
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.worker.html (0 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.worker.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.worker.html 2021-07-20 17:07:58 UTC (rev 280084)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs-expected.txt (280083 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs-expected.txt 2021-07-20 16:54:58 UTC (rev 280083)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs-expected.txt 2021-07-20 17:07:58 UTC (rev 280084)
@@ -1,7 +0,0 @@
-2d.getcontext.extraargs
-
-The 2D context ignores extra getContext arguments
-
-
-PASS The 2D context ignores extra getContext arguments
-
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache-expected.txt (0 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache-expected.txt 2021-07-20 17:07:58 UTC (rev 280084)
@@ -0,0 +1,7 @@
+2d.getcontext.extraargs.cache
+
+The 2D context doesn't throw with extra getContext arguments (cached)
+
+
+PASS The 2D context doesn't throw with extra getContext arguments (cached)
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.html (0 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.html 2021-07-20 17:07:58 UTC (rev 280084)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.getcontext.extraargs.cache</title>
+<script src=""
+<script src=""
+<script src=""
+
+<h1>2d.getcontext.extraargs.cache</h1>
+<p class="desc">The 2D context doesn't throw with extra getContext arguments (cached)</p>
+
+
+<script>
+var t = async_test("The 2D context doesn't throw with extra getContext arguments (cached)");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+var offscreenCanvas = new OffscreenCanvas(100, 50);
+var ctx = offscreenCanvas.getContext('2d');
+
+_assertDifferent(offscreenCanvas.getContext('2d', false, {}, [], 1, "2"), null, "offscreenCanvas.getContext('2d', false, {}, [], 1, \"2\")", "null");
+_assertDifferent(offscreenCanvas.getContext('2d', 123), null, "offscreenCanvas.getContext('2d', 123)", "null");
+_assertDifferent(offscreenCanvas.getContext('2d', "test"), null, "offscreenCanvas.getContext('2d', \"test\")", "null");
+_assertDifferent(offscreenCanvas.getContext('2d', undefined), null, "offscreenCanvas.getContext('2d', undefined)", "null");
+_assertDifferent(offscreenCanvas.getContext('2d', null), null, "offscreenCanvas.getContext('2d', null)", "null");
+_assertDifferent(offscreenCanvas.getContext('2d', Symbol.hasInstance), null, "offscreenCanvas.getContext('2d', Symbol.hasInstance)", "null");
+t.done();
+
+});
+</script>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.worker-expected.txt (0 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.worker-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.worker-expected.txt 2021-07-20 17:07:58 UTC (rev 280084)
@@ -0,0 +1,3 @@
+
+PASS The 2D context doesn't throw with extra getContext arguments (cached)
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.worker.html (0 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.worker.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.worker.html 2021-07-20 17:07:58 UTC (rev 280084)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.worker.js (0 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.worker.js (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.worker.js 2021-07-20 17:07:58 UTC (rev 280084)
@@ -0,0 +1,28 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.getcontext.extraargs.cache
+// Description:The 2D context doesn't throw with extra getContext arguments (cached)
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("The 2D context doesn't throw with extra getContext arguments (cached)");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+var offscreenCanvas = new OffscreenCanvas(100, 50);
+var ctx = offscreenCanvas.getContext('2d');
+
+_assertDifferent(offscreenCanvas.getContext('2d', false, {}, [], 1, "2"), null, "offscreenCanvas.getContext('2d', false, {}, [], 1, \"2\")", "null");
+_assertDifferent(offscreenCanvas.getContext('2d', 123), null, "offscreenCanvas.getContext('2d', 123)", "null");
+_assertDifferent(offscreenCanvas.getContext('2d', "test"), null, "offscreenCanvas.getContext('2d', \"test\")", "null");
+_assertDifferent(offscreenCanvas.getContext('2d', undefined), null, "offscreenCanvas.getContext('2d', undefined)", "null");
+_assertDifferent(offscreenCanvas.getContext('2d', null), null, "offscreenCanvas.getContext('2d', null)", "null");
+_assertDifferent(offscreenCanvas.getContext('2d', Symbol.hasInstance), null, "offscreenCanvas.getContext('2d', Symbol.hasInstance)", "null");
+t.done();
+
+});
+done();
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create-expected.txt (0 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create-expected.txt 2021-07-20 17:07:58 UTC (rev 280084)
@@ -0,0 +1,7 @@
+2d.getcontext.extraargs.create
+
+The 2D context doesn't throw with extra getContext arguments (new context)
+
+
+PASS The 2D context doesn't throw with extra getContext arguments (new context)
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.html (0 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.html 2021-07-20 17:07:58 UTC (rev 280084)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.getcontext.extraargs.create</title>
+<script src=""
+<script src=""
+<script src=""
+
+<h1>2d.getcontext.extraargs.create</h1>
+<p class="desc">The 2D context doesn't throw with extra getContext arguments (new context)</p>
+
+
+<script>
+var t = async_test("The 2D context doesn't throw with extra getContext arguments (new context)");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+var offscreenCanvas = new OffscreenCanvas(100, 50);
+var ctx = offscreenCanvas.getContext('2d');
+
+_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', false, {}, [], 1, "2"), null, "(new OffscreenCanvas(100, 50)).getContext('2d', false, {}, [], 1, \"2\")", "null");
+_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', 123), null, "(new OffscreenCanvas(100, 50)).getContext('2d', 123)", "null");
+_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', "test"), null, "(new OffscreenCanvas(100, 50)).getContext('2d', \"test\")", "null");
+_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', undefined), null, "(new OffscreenCanvas(100, 50)).getContext('2d', undefined)", "null");
+_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', null), null, "(new OffscreenCanvas(100, 50)).getContext('2d', null)", "null");
+_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', Symbol.hasInstance), null, "(new OffscreenCanvas(100, 50)).getContext('2d', Symbol.hasInstance)", "null");
+t.done();
+
+});
+</script>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.worker-expected.txt (0 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.worker-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.worker-expected.txt 2021-07-20 17:07:58 UTC (rev 280084)
@@ -0,0 +1,3 @@
+
+PASS The 2D context doesn't throw with extra getContext arguments (new context)
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.worker.html (0 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.worker.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.worker.html 2021-07-20 17:07:58 UTC (rev 280084)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.worker.js (0 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.worker.js (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.worker.js 2021-07-20 17:07:58 UTC (rev 280084)
@@ -0,0 +1,28 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.getcontext.extraargs.create
+// Description:The 2D context doesn't throw with extra getContext arguments (new context)
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("The 2D context doesn't throw with extra getContext arguments (new context)");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+var offscreenCanvas = new OffscreenCanvas(100, 50);
+var ctx = offscreenCanvas.getContext('2d');
+
+_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', false, {}, [], 1, "2"), null, "(new OffscreenCanvas(100, 50)).getContext('2d', false, {}, [], 1, \"2\")", "null");
+_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', 123), null, "(new OffscreenCanvas(100, 50)).getContext('2d', 123)", "null");
+_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', "test"), null, "(new OffscreenCanvas(100, 50)).getContext('2d', \"test\")", "null");
+_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', undefined), null, "(new OffscreenCanvas(100, 50)).getContext('2d', undefined)", "null");
+_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', null), null, "(new OffscreenCanvas(100, 50)).getContext('2d', null)", "null");
+_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', Symbol.hasInstance), null, "(new OffscreenCanvas(100, 50)).getContext('2d', Symbol.hasInstance)", "null");
+t.done();
+
+});
+done();
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.html (280083 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.html 2021-07-20 16:54:58 UTC (rev 280083)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.html 2021-07-20 17:07:58 UTC (rev 280084)
@@ -1,33 +0,0 @@
-<!DOCTYPE html>
-<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
-<title>OffscreenCanvas test: 2d.getcontext.extraargs</title>
-<script src=""
-<script src=""
-<script src=""
-
-<h1>2d.getcontext.extraargs</h1>
-<p class="desc">The 2D context ignores extra getContext arguments</p>
-
-
-<script>
-var t = async_test("The 2D context ignores extra getContext arguments");
-var t_pass = t.done.bind(t);
-var t_fail = t.step_func(function(reason) {
- throw reason;
-});
-t.step(function() {
-
-var offscreenCanvas = new OffscreenCanvas(100, 50);
-var ctx = offscreenCanvas.getContext('2d');
-
-var offscreenCanvas2 = new OffscreenCanvas(100, 50);
-_assertDifferent(offscreenCanvas2.getContext('2d', false, {}, [], 1, "2"), null, "offscreenCanvas2.getContext('2d', false, {}, [], 1, \"2\")", "null");
-_assertDifferent(offscreenCanvas2.getContext('2d', 123), null, "offscreenCanvas2.getContext('2d', 123)", "null");
-_assertDifferent(offscreenCanvas2.getContext('2d', "test"), null, "offscreenCanvas2.getContext('2d', \"test\")", "null");
-_assertDifferent(offscreenCanvas2.getContext('2d', undefined), null, "offscreenCanvas2.getContext('2d', undefined)", "null");
-_assertDifferent(offscreenCanvas2.getContext('2d', null), null, "offscreenCanvas2.getContext('2d', null)", "null");
-_assertDifferent(offscreenCanvas2.getContext('2d', Symbol.hasInstance), null, "offscreenCanvas2.getContext('2d', Symbol.hasInstance)", "null");
-t.done();
-
-});
-</script>
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.worker-expected.txt (280083 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.worker-expected.txt 2021-07-20 16:54:58 UTC (rev 280083)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.worker-expected.txt 2021-07-20 17:07:58 UTC (rev 280084)
@@ -1,3 +0,0 @@
-
-PASS The 2D context ignores extra getContext arguments
-
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.worker.js (280083 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.worker.js 2021-07-20 16:54:58 UTC (rev 280083)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.worker.js 2021-07-20 17:07:58 UTC (rev 280084)
@@ -1,29 +0,0 @@
-// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
-// OffscreenCanvas test in a worker:2d.getcontext.extraargs
-// Description:The 2D context ignores extra getContext arguments
-// Note:
-
-importScripts("/resources/testharness.js");
-importScripts("/html/canvas/resources/canvas-tests.js");
-
-var t = async_test("The 2D context ignores extra getContext arguments");
-var t_pass = t.done.bind(t);
-var t_fail = t.step_func(function(reason) {
- throw reason;
-});
-t.step(function() {
-
-var offscreenCanvas = new OffscreenCanvas(100, 50);
-var ctx = offscreenCanvas.getContext('2d');
-
-var offscreenCanvas2 = new OffscreenCanvas(100, 50);
-_assertDifferent(offscreenCanvas2.getContext('2d', false, {}, [], 1, "2"), null, "offscreenCanvas2.getContext('2d', false, {}, [], 1, \"2\")", "null");
-_assertDifferent(offscreenCanvas2.getContext('2d', 123), null, "offscreenCanvas2.getContext('2d', 123)", "null");
-_assertDifferent(offscreenCanvas2.getContext('2d', "test"), null, "offscreenCanvas2.getContext('2d', \"test\")", "null");
-_assertDifferent(offscreenCanvas2.getContext('2d', undefined), null, "offscreenCanvas2.getContext('2d', undefined)", "null");
-_assertDifferent(offscreenCanvas2.getContext('2d', null), null, "offscreenCanvas2.getContext('2d', null)", "null");
-_assertDifferent(offscreenCanvas2.getContext('2d', Symbol.hasInstance), null, "offscreenCanvas2.getContext('2d', Symbol.hasInstance)", "null");
-t.done();
-
-});
-done();
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/w3c-import.log (280083 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/w3c-import.log 2021-07-20 16:54:58 UTC (rev 280083)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/w3c-import.log 2021-07-20 17:07:58 UTC (rev 280084)
@@ -14,6 +14,7 @@
None
------------------------------------------------------------------------
List of files:
+/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.js
/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.readonly.html
/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.readonly.worker.js
/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.reference.html
@@ -20,8 +21,10 @@
/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.reference.worker.js
/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.exists.html
/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.exists.worker.js
-/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.html
-/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.worker.js
+/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.html
+/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.worker.js
+/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.html
+/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.worker.js
/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.shared.html
/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.shared.worker.js
/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.unique.html
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d-getcontext-options-expected.txt (0 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d-getcontext-options-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d-getcontext-options-expected.txt 2021-07-20 17:07:58 UTC (rev 280084)
@@ -0,0 +1,3 @@
+
+FAIL Options conversion for getContext("2d") assert_array_equals: order of operations (creation) lengths differ, expected array ["alpha", "colorSpace", "colorSpace toString", "desynchronized", "willReadFrequently"] length 5, got ["colorSpace", "colorSpace toString", "desynchronized"] length 3
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d-getcontext-options.html (0 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d-getcontext-options.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d-getcontext-options.html 2021-07-20 17:07:58 UTC (rev 280084)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<title>Options conversion for getContext("2d")</title>
+<script src=""
+<script src=""
+<script>
+test(() => {
+ const expected = [
+ "alpha",
+ "colorSpace",
+ "colorSpace toString",
+ "desynchronized",
+ "willReadFrequently",
+ ];
+ const actual = [];
+ const options = {
+ get alpha() {
+ actual.push("alpha");
+ return true;
+ },
+ get willReadFrequently() {
+ actual.push("willReadFrequently");
+ return false;
+ },
+ get desynchronized() {
+ actual.push("desynchronized");
+ return false;
+ },
+ get colorSpace() {
+ actual.push("colorSpace");
+ return {
+ toString() {
+ actual.push("colorSpace toString");
+ return "srgb";
+ }
+ };
+ },
+ };
+
+ const canvas = document.createElement("canvas");
+ const context = canvas.getContext('2d', options);
+ assert_not_equals(context, null, "context");
+ assert_array_equals(actual, expected, "order of operations (creation)");
+ assert_equals(canvas.getContext('2d', options), context, "cached context");
+ assert_array_equals(actual, expected, "order of operations (caching)");
+});
+</script>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.cache-expected.txt (0 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.cache-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.cache-expected.txt 2021-07-20 17:07:58 UTC (rev 280084)
@@ -0,0 +1,6 @@
+2d.getcontext.extraargs.cache
+The 2D context doesn't throw with extra getContext arguments (cached)
+Actual output:
+
+PASS The 2D context doesn't throw with extra getContext arguments (cached)
+
Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.cache.html (from rev 280083, trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.html) (0 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.cache.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.cache.html 2021-07-20 17:07:58 UTC (rev 280084)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.getcontext.extraargs.cache</title>
+<script src=""
+<script src=""
+<script src=""
+<link rel="stylesheet" href=""
+<body class="show_output">
+
+<h1>2d.getcontext.extraargs.cache</h1>
+<p class="desc">The 2D context doesn't throw with extra getContext arguments (cached)</p>
+
+
+<p class="output">Actual output:</p>
+<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
+
+<ul id="d"></ul>
+<script>
+var t = async_test("The 2D context doesn't throw with extra getContext arguments (cached)");
+_addTest(function(canvas, ctx) {
+
+_assertDifferent(canvas.getContext('2d', false, {}, [], 1, "2"), null, "canvas.getContext('2d', false, {}, [], 1, \"2\")", "null");
+_assertDifferent(canvas.getContext('2d', 123), null, "canvas.getContext('2d', 123)", "null");
+_assertDifferent(canvas.getContext('2d', "test"), null, "canvas.getContext('2d', \"test\")", "null");
+_assertDifferent(canvas.getContext('2d', undefined), null, "canvas.getContext('2d', undefined)", "null");
+_assertDifferent(canvas.getContext('2d', null), null, "canvas.getContext('2d', null)", "null");
+_assertDifferent(canvas.getContext('2d', Symbol.hasInstance), null, "canvas.getContext('2d', Symbol.hasInstance)", "null");
+
+
+});
+</script>
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.create-expected.txt (0 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.create-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.create-expected.txt 2021-07-20 17:07:58 UTC (rev 280084)
@@ -0,0 +1,6 @@
+2d.getcontext.extraargs.create
+The 2D context doesn't throw with extra getContext arguments (new context)
+Actual output:
+
+PASS The 2D context doesn't throw with extra getContext arguments (new context)
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.create.html (0 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.create.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.create.html 2021-07-20 17:07:58 UTC (rev 280084)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.getcontext.extraargs.create</title>
+<script src=""
+<script src=""
+<script src=""
+<link rel="stylesheet" href=""
+<body class="show_output">
+
+<h1>2d.getcontext.extraargs.create</h1>
+<p class="desc">The 2D context doesn't throw with extra getContext arguments (new context)</p>
+
+
+<p class="output">Actual output:</p>
+<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
+
+<ul id="d"></ul>
+<script>
+var t = async_test("The 2D context doesn't throw with extra getContext arguments (new context)");
+_addTest(function(canvas, ctx) {
+
+_assertDifferent(document.createElement("canvas").getContext('2d', false, {}, [], 1, "2"), null, "document.createElement(\"canvas\").getContext('2d', false, {}, [], 1, \"2\")", "null");
+_assertDifferent(document.createElement("canvas").getContext('2d', 123), null, "document.createElement(\"canvas\").getContext('2d', 123)", "null");
+_assertDifferent(document.createElement("canvas").getContext('2d', "test"), null, "document.createElement(\"canvas\").getContext('2d', \"test\")", "null");
+_assertDifferent(document.createElement("canvas").getContext('2d', undefined), null, "document.createElement(\"canvas\").getContext('2d', undefined)", "null");
+_assertDifferent(document.createElement("canvas").getContext('2d', null), null, "document.createElement(\"canvas\").getContext('2d', null)", "null");
+_assertDifferent(document.createElement("canvas").getContext('2d', Symbol.hasInstance), null, "document.createElement(\"canvas\").getContext('2d', Symbol.hasInstance)", "null");
+
+
+});
+</script>
+
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.html (280083 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.html 2021-07-20 16:54:58 UTC (rev 280083)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.html 2021-07-20 17:07:58 UTC (rev 280084)
@@ -1,32 +0,0 @@
-<!DOCTYPE html>
-<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
-<title>Canvas test: 2d.getcontext.extraargs</title>
-<script src=""
-<script src=""
-<script src=""
-<link rel="stylesheet" href=""
-<body class="show_output">
-
-<h1>2d.getcontext.extraargs</h1>
-<p class="desc">The 2D context ignores extra getContext arguments</p>
-
-
-<p class="output">Actual output:</p>
-<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
-
-<ul id="d"></ul>
-<script>
-var t = async_test("The 2D context ignores extra getContext arguments");
-_addTest(function(canvas, ctx) {
-
-_assertDifferent(canvas.getContext('2d', false, {}, [], 1, "2"), null, "canvas.getContext('2d', false, {}, [], 1, \"2\")", "null");
-_assertDifferent(canvas.getContext('2d', 123), null, "canvas.getContext('2d', 123)", "null");
-_assertDifferent(canvas.getContext('2d', "test"), null, "canvas.getContext('2d', \"test\")", "null");
-_assertDifferent(canvas.getContext('2d', undefined), null, "canvas.getContext('2d', undefined)", "null");
-_assertDifferent(canvas.getContext('2d', null), null, "canvas.getContext('2d', null)", "null");
-_assertDifferent(canvas.getContext('2d', Symbol.hasInstance), null, "canvas.getContext('2d', Symbol.hasInstance)", "null");
-
-
-});
-</script>
-
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/w3c-import.log (280083 => 280084)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/w3c-import.log 2021-07-20 16:54:58 UTC (rev 280083)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/w3c-import.log 2021-07-20 17:07:58 UTC (rev 280084)
@@ -14,11 +14,13 @@
None
------------------------------------------------------------------------
List of files:
+/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d-getcontext-options.html
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.canvas.context.html
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.canvas.readonly.html
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.canvas.reference.html
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.exists.html
-/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.html
+/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.cache.html
+/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.create.html
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.invalid.args.html
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.shared.html
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.unique.html
Modified: trunk/LayoutTests/platform/glib/TestExpectations (280083 => 280084)
--- trunk/LayoutTests/platform/glib/TestExpectations 2021-07-20 16:54:58 UTC (rev 280083)
+++ trunk/LayoutTests/platform/glib/TestExpectations 2021-07-20 17:07:58 UTC (rev 280084)
@@ -763,8 +763,6 @@
# Failing since r277543.
webkit.org/b/225870 imported/w3c/web-platform-tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.worker.html [ Failure ]
-webkit.org/b/225870 imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.html [ Failure ]
-webkit.org/b/225870 imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.worker.html [ Failure ]
#////////////////////////////////////////////////////////////////////////////////////////
# End of OffscreenCanvas-related bugs
Modified: trunk/Source/WebCore/ChangeLog (280083 => 280084)
--- trunk/Source/WebCore/ChangeLog 2021-07-20 16:54:58 UTC (rev 280083)
+++ trunk/Source/WebCore/ChangeLog 2021-07-20 17:07:58 UTC (rev 280084)
@@ -1,3 +1,27 @@
+2021-07-20 Chris Lord <[email protected]>
+
+ Canvas and OffscreenCanvas getContext should check if argument is an object before trying to convert it to a dictionary
+ https://bugs.webkit.org/show_bug.cgi?id=227792
+
+ Reviewed by Sam Weinig.
+
+ Check if options argument is an object before converting to a dictionary.
+
+ Tests: imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.html
+ imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.worker.html
+ imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.html
+ imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.worker.html
+ imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.html
+ imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.worker.html
+ imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d-getcontext-options.html
+ imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.cache.html
+ imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.create.html
+
+ * html/HTMLCanvasElement.cpp:
+ (WebCore::HTMLCanvasElement::getContext):
+ * html/OffscreenCanvas.cpp:
+ (WebCore::OffscreenCanvas::getContext):
+
2021-07-20 Alex Christensen <[email protected]>
Protect m_data when iterating in CachedRawResource::didAddClient
Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (280083 => 280084)
--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2021-07-20 16:54:58 UTC (rev 280083)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2021-07-20 17:07:58 UTC (rev 280084)
@@ -284,7 +284,7 @@
if (is2dType(contextId)) {
auto scope = DECLARE_THROW_SCOPE(state.vm());
- auto settings = convert<IDLDictionary<CanvasRenderingContext2DSettings>>(state, !arguments.isEmpty() ? arguments[0].get() : JSC::jsUndefined());
+ auto settings = convert<IDLDictionary<CanvasRenderingContext2DSettings>>(state, arguments.isEmpty() ? JSC::jsUndefined() : (arguments[0].isObject() ? arguments[0].get() : JSC::jsNull()));
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
auto context = createContext2d(contextId, WTFMove(settings));
@@ -295,7 +295,7 @@
if (isBitmapRendererType(contextId)) {
auto scope = DECLARE_THROW_SCOPE(state.vm());
- auto settings = convert<IDLDictionary<ImageBitmapRenderingContextSettings>>(state, !arguments.isEmpty() ? arguments[0].get() : JSC::jsUndefined());
+ auto settings = convert<IDLDictionary<ImageBitmapRenderingContextSettings>>(state, arguments.isEmpty() ? JSC::jsUndefined() : (arguments[0].isObject() ? arguments[0].get() : JSC::jsNull()));
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
auto context = createContextBitmapRenderer(contextId, WTFMove(settings));
@@ -307,7 +307,7 @@
#if ENABLE(WEBGL)
if (isWebGLType(contextId)) {
auto scope = DECLARE_THROW_SCOPE(state.vm());
- auto attributes = convert<IDLDictionary<WebGLContextAttributes>>(state, !arguments.isEmpty() ? arguments[0].get() : JSC::jsUndefined());
+ auto attributes = convert<IDLDictionary<WebGLContextAttributes>>(state, arguments.isEmpty() ? JSC::jsUndefined() : (arguments[0].isObject() ? arguments[0].get() : JSC::jsNull()));
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
auto context = createContextWebGL(toWebGLVersion(contextId), WTFMove(attributes));
Modified: trunk/Source/WebCore/html/OffscreenCanvas.cpp (280083 => 280084)
--- trunk/Source/WebCore/html/OffscreenCanvas.cpp 2021-07-20 16:54:58 UTC (rev 280083)
+++ trunk/Source/WebCore/html/OffscreenCanvas.cpp 2021-07-20 17:07:58 UTC (rev 280084)
@@ -226,7 +226,7 @@
}
auto scope = DECLARE_THROW_SCOPE(state.vm());
- auto settings = convert<IDLDictionary<CanvasRenderingContext2DSettings>>(state, !arguments.isEmpty() ? arguments[0].get() : JSC::jsUndefined());
+ auto settings = convert<IDLDictionary<CanvasRenderingContext2DSettings>>(state, arguments.isEmpty() ? JSC::jsUndefined() : (arguments[0].isObject() ? arguments[0].get() : JSC::jsNull()));
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
m_context = makeUnique<OffscreenCanvasRenderingContext2D>(*this, WTFMove(settings));
@@ -248,7 +248,7 @@
}
auto scope = DECLARE_THROW_SCOPE(state.vm());
- auto attributes = convert<IDLDictionary<WebGLContextAttributes>>(state, !arguments.isEmpty() ? arguments[0].get() : JSC::jsUndefined());
+ auto attributes = convert<IDLDictionary<WebGLContextAttributes>>(state, arguments.isEmpty() ? JSC::jsUndefined() : (arguments[0].isObject() ? arguments[0].get() : JSC::jsNull()));
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
createContextWebGL(contextType, WTFMove(attributes));