From 730cb1c2333c5205776eff625e1dafe7399e364d Mon Sep 17 00:00:00 2001 From: Bob Clary Date: Thu, 27 Nov 2008 02:29:40 -0800 Subject: [PATCH] bug 466606 - JavaScript Tests - Do not force language version upon non-Gecko browsers. --- js/tests/browser.js | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/js/tests/browser.js b/js/tests/browser.js index a85a937c0170..b349fbe2f7ec 100755 --- a/js/tests/browser.js +++ b/js/tests/browser.js @@ -654,11 +654,34 @@ function jsTestDriverBrowserInit() jit(false); } - var versionmatches = /version=([.0-9]*)/.exec(value); + var versionmatches; - if (!versionmatches) + if (attribute == 'type') { - value = 'text/javascript;version='; + versionmatches = /version=([.0-9]+)/.exec(value); + } + else + { + versionmatches = /javascript([.0-9]+)/.exec(value); + } + + if (versionmatches) + { + gVersion = 10*parseInt(versionmatches[1].replace(/\./g, '')); + } + else if (navigator.userAgent.indexOf('Gecko/') != -1) + { + // If the version is not specified, and the browser is Gecko, + // adjust the version to match the suite version. + if (attribute == 'type') + { + value = 'text/javascript;version='; + } + else + { + value = 'javascript'; + } + if (testpath.match(/^js1_6/)) { gVersion = 160; @@ -685,10 +708,6 @@ function jsTestDriverBrowserInit() value += '1.5'; } } - else - { - gVersion = 10*parseInt(versionmatches[1].replace(/\./g, '')); - } var testpathparts = testpath.split(/\//);