summaryrefslogtreecommitdiffstats
path: root/dom/canvas/test/webgl-conf/checkout/js/js-test-pre.js
diff options
context:
space:
mode:
Diffstat (limited to 'dom/canvas/test/webgl-conf/checkout/js/js-test-pre.js')
-rw-r--r--dom/canvas/test/webgl-conf/checkout/js/js-test-pre.js21
1 files changed, 13 insertions, 8 deletions
diff --git a/dom/canvas/test/webgl-conf/checkout/js/js-test-pre.js b/dom/canvas/test/webgl-conf/checkout/js/js-test-pre.js
index e1cb9f749c..adc1f8a5aa 100644
--- a/dom/canvas/test/webgl-conf/checkout/js/js-test-pre.js
+++ b/dom/canvas/test/webgl-conf/checkout/js/js-test-pre.js
@@ -93,20 +93,25 @@ const RESULTS = {
fail: 0,
};
+// We cache these values since they will potentially be accessed many (100k+)
+// times and accessing window can be significantly slower than a local variable.
+const locationPathname = window.location.pathname;
+const webglTestHarness = window.parent.webglTestHarness;
+
function reportTestResultsToHarness(success, msg) {
if (success) {
RESULTS.pass += 1;
} else {
RESULTS.fail += 1;
}
- if (window.parent.webglTestHarness) {
- window.parent.webglTestHarness.reportResults(window.location.pathname, success, msg);
+ if (webglTestHarness) {
+ webglTestHarness.reportResults(locationPathname, success, msg);
}
}
function reportSkippedTestResultsToHarness(success, msg) {
- if (window.parent.webglTestHarness) {
- window.parent.webglTestHarness.reportResults(window.location.pathname, success, msg, true);
+ if (webglTestHarness) {
+ webglTestHarness.reportResults(locationPathname, success, msg, true);
}
}
@@ -116,8 +121,8 @@ function notifyFinishedToHarness() {
}
window._didNotifyFinishedToHarness = true;
- if (window.parent.webglTestHarness) {
- window.parent.webglTestHarness.notifyFinished(window.location.pathname);
+ if (webglTestHarness) {
+ webglTestHarness.notifyFinished(locationPathname);
}
if (window.nonKhronosFrameworkNotifyDone) {
window.nonKhronosFrameworkNotifyDone();
@@ -268,9 +273,9 @@ function getCurrentTestName()
*/
function testPassedOptions(msg, addSpan)
{
+ reportTestResultsToHarness(true, _currentTestName + ": " + msg);
if (addSpan && !quietMode())
{
- reportTestResultsToHarness(true, _currentTestName + ": " + msg);
_addSpan('<span><span class="pass">PASS</span> ' + escapeHTML(_currentTestName) + ": " + escapeHTML(msg) + '</span>');
}
if (_jsTestPreVerboseLogging) {
@@ -285,9 +290,9 @@ function testPassedOptions(msg, addSpan)
*/
function testSkippedOptions(msg, addSpan)
{
+ reportSkippedTestResultsToHarness(true, _currentTestName + ": " + msg);
if (addSpan && !quietMode())
{
- reportSkippedTestResultsToHarness(true, _currentTestName + ": " + msg);
_addSpan('<span><span class="warn">SKIP</span> ' + escapeHTML(_currentTestName) + ": " + escapeHTML(msg) + '</span>');
}
if (_jsTestPreVerboseLogging) {