diff --git a/conformance-suites/1.0.3/conformance/context/context-methods.js b/conformance-suites/1.0.3/conformance/context/context-methods.js
new file mode 100644
index 0000000000..f6476463d2
--- /dev/null
+++ b/conformance-suites/1.0.3/conformance/context/context-methods.js
@@ -0,0 +1,52 @@
+"use strict";
+
+// Properties to be ignored because they were added in versions of the
+// spec that are backward-compatible with this version
+const IGNORED_METHODS = [
+ // There is no official spec for the commit API yet, the proposal link is:
+ // https://wiki.whatwg.org/wiki/OffscreenCanvas
+ "commit",
+
+ // For WebXR integration:
+ "makeXRCompatible",
+];
+
+function assertFunction(v, f) {
+ try {
+ if (typeof v[f] != "function") {
+ testFailed(`Property either does not exist or is not a function: ${f}`);
+ return false;
+ } else {
+ return true;
+ }
+ } catch(e) {
+ testFailed(`Trying to access the property '${f}' threw an error: ${e.toString()}`);
+ }
+}
+
+function testContextMethods(gl, requiredContextMethods) {
+ const acceptableMethods = [].concat(requiredContextMethods, IGNORED_METHODS);
+
+ let passed = true;
+ requiredContextMethods.forEach(method => {
+ const r = assertFunction(gl, method);
+ passed = passed && r;
+ });
+ if (passed) {
+ testPassed("All WebGL methods found.");
+ }
+ let extended = false;
+ for (let propertyName of Object.getOwnPropertyNames(gl)) {
+ if (typeof gl[propertyName] == "function" && !acceptableMethods.includes(propertyName)) {
+ if (!extended) {
+ extended = true;
+ testFailed("Also found the following extra methods:");
+ }
+ testFailed(propertyName);
+ }
+ }
+
+ if (!extended) {
+ testPassed("No extra methods found on WebGL context.");
+ }
+}
diff --git a/conformance-suites/1.0.3/conformance/context/methods.html b/conformance-suites/1.0.3/conformance/context/methods.html
index cc63665630..2a36ca16b3 100644
--- a/conformance-suites/1.0.3/conformance/context/methods.html
+++ b/conformance-suites/1.0.3/conformance/context/methods.html
@@ -32,6 +32,7 @@
+
@@ -180,52 +181,14 @@
"viewport"
];
-// Properties to be ignored because they were added in versions of the
-// spec that are backward-compatible with this version
-var ignoredMethods = [
-];
-
-function assertFunction(v, f) {
- try {
- if (typeof v[f] != "function") {
- testFailed("Property either does not exist or is not a function: " + f);
- return false;
- } else {
- return true;
- }
- } catch(e) {
- testFailed("Trying to access the property '" + f + "' threw an error: "+e.toString());
- }
-}
-
debug("");
debug("Canvas.getContext");
var wtu = WebGLTestUtils;
var canvas = document.getElementById("canvas");
var gl = wtu.create3DContext(canvas);
-var passed = true;
-for (var i=0; i
+
@@ -180,55 +181,14 @@
"viewport"
];
-// Properties to be ignored because they were added in versions of the
-// spec that are backward-compatible with this version
-var ignoredMethods = [
- // There is no official spec for the commit API yet, the proposal link is:
- // https://wiki.whatwg.org/wiki/OffscreenCanvas
- "commit"
-];
-
-function assertFunction(v, f) {
- try {
- if (typeof v[f] != "function") {
- testFailed("Property either does not exist or is not a function: " + f);
- return false;
- } else {
- return true;
- }
- } catch(e) {
- testFailed("Trying to access the property '" + f + "' threw an error: "+e.toString());
- }
-}
-
debug("");
debug("Canvas.getContext");
var wtu = WebGLTestUtils;
var canvas = document.getElementById("canvas");
var gl = wtu.create3DContext(canvas);
-var passed = true;
-for (var i=0; i
+
@@ -270,55 +271,14 @@
"bindVertexArray",
];
-// Properties to be ignored because they were added in versions of the
-// spec that are backward-compatible with this version
-var ignoredMethods = [
- // There is no official spec for the commit API yet, the proposal link is:
- // https://wiki.whatwg.org/wiki/OffscreenCanvas
- "commit"
-];
-
-function assertFunction(v, f) {
- try {
- if (typeof v[f] != "function") {
- testFailed("Property either does not exist or is not a function: " + f);
- return false;
- } else {
- return true;
- }
- } catch(e) {
- testFailed("Trying to access the property '" + f + "' threw an error: "+e.toString());
- }
-}
-
debug("");
debug("Canvas.getContext");
var wtu = WebGLTestUtils;
var canvas = document.getElementById("canvas");
var gl = wtu.create3DContext(canvas, null, 2);
-var passed = true;
-for (var i=0; i {
+ const r = assertFunction(gl, method);
+ passed = passed && r;
+ });
+ if (passed) {
+ testPassed("All WebGL methods found.");
+ }
+ let extended = false;
+ for (let propertyName of Object.getOwnPropertyNames(gl)) {
+ if (typeof gl[propertyName] == "function" && !acceptableMethods.includes(propertyName)) {
+ if (!extended) {
+ extended = true;
+ testFailed("Also found the following extra methods:");
+ }
+ testFailed(propertyName);
+ }
+ }
+
+ if (!extended) {
+ testPassed("No extra methods found on WebGL context.");
+ }
+}
diff --git a/sdk/tests/conformance/context/methods.html b/sdk/tests/conformance/context/methods.html
index e5274fb980..d1e47f32a3 100644
--- a/sdk/tests/conformance/context/methods.html
+++ b/sdk/tests/conformance/context/methods.html
@@ -11,6 +11,7 @@
+
@@ -20,7 +21,7 @@
"use strict";
description("This test ensures that the WebGL context has all the methods in the specification.");
-var methods = [
+const methods = [
"getContextAttributes",
"activeTexture",
"attachShader",
@@ -159,55 +160,14 @@
"viewport"
];
-// Properties to be ignored because they were added in versions of the
-// spec that are backward-compatible with this version
-var ignoredMethods = [
- // There is no official spec for the commit API yet, the proposal link is:
- // https://wiki.whatwg.org/wiki/OffscreenCanvas
- "commit"
-];
-
-function assertFunction(v, f) {
- try {
- if (typeof v[f] != "function") {
- testFailed("Property either does not exist or is not a function: " + f);
- return false;
- } else {
- return true;
- }
- } catch(e) {
- testFailed("Trying to access the property '" + f + "' threw an error: "+e.toString());
- }
-}
-
debug("");
debug("Canvas.getContext");
-var wtu = WebGLTestUtils;
-var canvas = document.getElementById("canvas");
-var gl = wtu.create3DContext(canvas);
-var passed = true;
-for (var i=0; i
+
@@ -20,7 +21,7 @@
"use strict";
description("This test ensures that the WebGL context has all the methods in the specification.");
-var methods = [
+const methods = [
"getContextAttributes",
"activeTexture",
"attachShader",
@@ -249,55 +250,14 @@
"bindVertexArray",
];
-// Properties to be ignored because they were added in versions of the
-// spec that are backward-compatible with this version
-var ignoredMethods = [
- // There is no official spec for the commit API yet, the proposal link is:
- // https://wiki.whatwg.org/wiki/OffscreenCanvas
- "commit"
-];
-
-function assertFunction(v, f) {
- try {
- if (typeof v[f] != "function") {
- testFailed("Property either does not exist or is not a function: " + f);
- return false;
- } else {
- return true;
- }
- } catch(e) {
- testFailed("Trying to access the property '" + f + "' threw an error: "+e.toString());
- }
-}
-
debug("");
debug("Canvas.getContext");
-var wtu = WebGLTestUtils;
-var canvas = document.getElementById("canvas");
-var gl = wtu.create3DContext(canvas, null, 2);
-var passed = true;
-for (var i=0; i {
+ const r = assertFunction(gl, method);
+ passed = passed && r;
+ });
+ if (passed) {
+ testPassed("All WebGL methods found.");
+ }
+ let extended = false;
+ for (let propertyName of Object.getOwnPropertyNames(gl)) {
+ if (typeof gl[propertyName] == "function" && !acceptableMethods.includes(propertyName)) {
+ if (!extended) {
+ extended = true;
+ testFailed("Also found the following extra methods:");
+ }
+ testFailed(propertyName);
+ }
+ }
+
+ if (!extended) {
+ testPassed("No extra methods found on WebGL context.");
+ }
+}