| Index: mozilla-tests/browser.js
|
| ===================================================================
|
| --- mozilla-tests/browser.js (revision 43940)
|
| +++ mozilla-tests/browser.js (working copy)
|
| @@ -568,6 +568,30 @@
|
| javascriptoptions.setIntPref('gczeal', Number(z));
|
| }
|
|
|
| +var gJit = { content: undefined, chrome: undefined };
|
| +
|
| +function jit(on)
|
| +{
|
| + var jitoptions = new Preferences('javascript.options.jit.');
|
| +
|
| + if (typeof gJit.content == 'undefined')
|
| + {
|
| + gJit.content = jitoptions.getBoolPref('content');
|
| + gJit.chrome = jitoptions.getBoolPref('chrome');
|
| + }
|
| +
|
| + if (on)
|
| + {
|
| + jitoptions.setBoolPref('content', true);
|
| + jitoptions.setBoolPref('chrome', false);
|
| + }
|
| + else
|
| + {
|
| + jitoptions.setBoolPref('content', false);
|
| + jitoptions.setBoolPref('chrome', false);
|
| + }
|
| +}
|
| +
|
| var gVersion = 150;
|
|
|
| function jsTestDriverBrowserInit()
|
| @@ -586,41 +610,84 @@
|
| return;
|
| }
|
|
|
| - var re = /test=([^;]+);language=(language|type);([a-zA-Z0-9.=;\/]+)/;
|
| - var matches = re.exec(document.location.search);
|
| + var properties = {};
|
| + var fields = document.location.search.slice(1).split(';');
|
| + for (var ifield = 0; ifield < fields.length; ifield++)
|
| + {
|
| + var propertycaptures = /^([^=]+)=(.*)$/.exec(fields[ifield]);
|
| + if (!propertycaptures)
|
| + {
|
| + properties[fields[ifield]] = true;
|
| + }
|
| + else
|
| + {
|
| + properties[propertycaptures[1]] = decodeURIComponent(propertycaptures[2]);
|
| + if (propertycaptures[1] == 'language')
|
| + {
|
| + // language=(type|language);mimetype
|
| + properties.mimetype = fields[ifield+1];
|
| + }
|
| + }
|
| + }
|
|
|
| - // testpath http://machine/path-to-suite/sub-suite/test.js
|
| - var testpath = matches[1];
|
| - var attribute = matches[2];
|
| - var value = matches[3];
|
| + if (properties.language != 'type')
|
| + {
|
| + try
|
| + {
|
| + properties.version = /javascript([.0-9]+)/.exec(properties.mimetype)[1];
|
| + }
|
| + catch(ex)
|
| + {
|
| + }
|
| + }
|
|
|
| - if (testpath)
|
| + if (!properties.version && navigator.userAgent.indexOf('Gecko/') != -1)
|
| {
|
| - gTestPath = testpath;
|
| + // If the version is not specified, and the browser is Gecko,
|
| + // adjust the version to match the suite version.
|
| + if (properties.test.match(/^js1_6/))
|
| + {
|
| + properties.version = '1.6';
|
| + }
|
| + else if (properties.test.match(/^js1_7/))
|
| + {
|
| + properties.version = '1.7';
|
| + }
|
| + else if (properties.test.match(/^js1_8/))
|
| + {
|
| + properties.version = '1.8';
|
| + }
|
| + else if (properties.test.match(/^js1_8_1/))
|
| + {
|
| + properties.version = '1.8';
|
| + }
|
| + else
|
| + {
|
| + properties.version = '1.5';
|
| + }
|
| }
|
|
|
| - var ise4x = /e4x\//.test(testpath);
|
| + gTestPath = properties.test;
|
|
|
| - var gczealmatches = /gczeal=([0-9]*)/.exec(document.location.search);
|
| + gVersion = 10*parseInt(properties.version.replace(/\./g, ''));
|
|
|
| - if (gczealmatches)
|
| + if (properties.gczeal)
|
| {
|
| - var zeal = Number(gczealmatches[1]);
|
| - gczeal(zeal);
|
| + gczeal(Number(properties.gczeal));
|
| }
|
|
|
| - var versionmatches = /version=([.0-9]*)/.exec(value);
|
| + /*
|
| + * since the default setting of jit changed from false to true
|
| + * in http://hg.mozilla.org/tracemonkey/rev/685e00e68be9
|
| + * bisections which depend upon jit settings can be thrown off.
|
| + * default jit(false) to make bisections depending upon jit settings
|
| + * consistent over time. This is not needed in shell tests as the default
|
| + * jit setting has not changed there.
|
| + */
|
|
|
| - if (!versionmatches)
|
| - {
|
| - gVersion = 150;
|
| - }
|
| - else
|
| - {
|
| - gVersion = 10*parseInt(versionmatches[1].replace(/\./g, ''));
|
| - }
|
| + jit(properties.jit);
|
|
|
| - var testpathparts = testpath.split(/\//);
|
| + var testpathparts = properties.test.split(/\//);
|
|
|
| if (testpathparts.length < 3)
|
| {
|
| @@ -631,53 +698,59 @@
|
| var subsuite = testpathparts[testpathparts.length - 2];
|
| var test = testpathparts[testpathparts.length - 1];
|
|
|
| - outputscripttag(suitepath + '/shell.js', attribute, value,
|
| - ise4x);
|
| - outputscripttag(suitepath + '/browser.js', attribute, value,
|
| - ise4x);
|
| - outputscripttag(suitepath + '/' + subsuite + '/shell.js', attribute, value,
|
| - ise4x);
|
| - outputscripttag(suitepath + '/' + subsuite + '/browser.js', attribute, value,
|
| - ise4x);
|
| - outputscripttag(suitepath + '/' + subsuite + '/' + test, attribute, value,
|
| - ise4x);
|
| + document.write('<title>' + suitepath + '/' + subsuite + '/' + test + '<\/title>');
|
|
|
| - document.write('<title>' + suitepath + '/' + subsuite + '/' + test +
|
| - '<\/title>');
|
| + // XXX bc - the first document.written script is ignored if the protocol
|
| + // is file:. insert an empty script tag, to work around it.
|
| + document.write('<script></script>');
|
|
|
| - outputscripttag('js-test-driver-end.js', attribute, value,
|
| - false);
|
| + outputscripttag(suitepath + '/shell.js', properties);
|
| + outputscripttag(suitepath + '/browser.js', properties);
|
| + outputscripttag(suitepath + '/' + subsuite + '/shell.js', properties);
|
| + outputscripttag(suitepath + '/' + subsuite + '/browser.js', properties);
|
| + outputscripttag(suitepath + '/' + subsuite + '/' + test, properties,
|
| + properties.e4x || /e4x\//.test(properties.test));
|
| + outputscripttag('js-test-driver-end.js', properties);
|
| return;
|
| }
|
|
|
| -function outputscripttag(src, attribute, value, ise4x)
|
| +function outputscripttag(src, properties, e4x)
|
| {
|
| if (!src)
|
| {
|
| return;
|
| }
|
|
|
| + if (e4x)
|
| + {
|
| + // e4x requires type=mimetype;e4x=1
|
| + properties.language = 'type';
|
| + }
|
| +
|
| var s = '<script src="' + src + '" ';
|
|
|
| - if (ise4x)
|
| + if (properties.language != 'type')
|
| {
|
| - if (attribute == 'type')
|
| + s += 'language="javascript';
|
| + if (properties.version)
|
| {
|
| - value += ';e4x=1 ';
|
| + s += properties.version;
|
| }
|
| - else
|
| + }
|
| + else
|
| + {
|
| + s += 'type="' + properties.mimetype;
|
| + if (properties.version)
|
| {
|
| - s += ' type="text/javascript';
|
| - if (gVersion != 150)
|
| - {
|
| - s += ';version=' + gVersion/100;
|
| - }
|
| - s += ';e4x=1" ';
|
| + s += ';version=' + properties.version;
|
| }
|
| + if (e4x)
|
| + {
|
| + s += ';e4x=1';
|
| + }
|
| }
|
| + s += '"><\/script>';
|
|
|
| - s += attribute + '="' + value + '"><\/script>';
|
| -
|
| document.write(s);
|
| }
|
|
|
| @@ -702,6 +775,18 @@
|
| {
|
| var javascriptoptions = new Preferences('javascript.options.');
|
| javascriptoptions.clearPref('gczeal');
|
| +
|
| + var jitoptions = new Preferences('javascript.options.jit.');
|
| + if (typeof gJit.content != 'undefined')
|
| + {
|
| + jitoptions.setBoolPref('content', gJit.content);
|
| + }
|
| +
|
| + if (typeof gJit.chrome != 'undefined')
|
| + {
|
| + jitoptions.setBoolPref('chrome', gJit.chrome);
|
| + }
|
| +
|
| optionsReset();
|
| }
|
| catch(ex)
|
|
|