summaryrefslogtreecommitdiff
path: root/tests/test_tools/selenium/core/scripts/selenium-browserdetect.js
diff options
context:
space:
mode:
authorxue <>2007-03-26 00:27:59 +0000
committerxue <>2007-03-26 00:27:59 +0000
commit0f00e85e311955b3f84dde559da6b5a2ab5c3cda (patch)
treeccb93c4e2d056c69209307fcb680fc23a9c57370 /tests/test_tools/selenium/core/scripts/selenium-browserdetect.js
parentcbee2945d1858f7f256b44a3fbfe816dc0202f4d (diff)
merge from 3.0 branch till 1769.
Diffstat (limited to 'tests/test_tools/selenium/core/scripts/selenium-browserdetect.js')
-rw-r--r--tests/test_tools/selenium/core/scripts/selenium-browserdetect.js48
1 files changed, 41 insertions, 7 deletions
diff --git a/tests/test_tools/selenium/core/scripts/selenium-browserdetect.js b/tests/test_tools/selenium/core/scripts/selenium-browserdetect.js
index d97e5a58..a9607371 100644
--- a/tests/test_tools/selenium/core/scripts/selenium-browserdetect.js
+++ b/tests/test_tools/selenium/core/scripts/selenium-browserdetect.js
@@ -30,32 +30,66 @@ var BrowserVersion = function() {
return;
}
+ var _getQueryParameter = function(searchKey) {
+ var str = location.search.substr(1);
+ if (str == null) return null;
+ var clauses = str.split('&');
+ for (var i = 0; i < clauses.length; i++) {
+ var keyValuePair = clauses[i].split('=', 2);
+ var key = unescape(keyValuePair[0]);
+ if (key == searchKey) {
+ return unescape(keyValuePair[1]);
+ }
+ }
+ return null;
+ };
+
var self = this;
var checkChrome = function() {
var loc = window.document.location.href;
try {
loc = window.top.document.location.href;
+ if (/^chrome:\/\//.test(loc)) {
+ self.isChrome = true;
+ } else {
+ self.isChrome = false;
+ }
} catch (e) {
// can't see the top (that means we might be chrome, but it's impossible to be sure)
self.isChromeDetectable = "no, top location couldn't be read in this window";
+ if (_getQueryParameter('thisIsChrome')) {
+ self.isChrome = true;
+ } else {
+ self.isChrome = false;
+ }
}
- if (/^chrome:\/\//.test(loc)) {
- self.isChrome = true;
- } else {
- self.isChrome = false;
- }
+
}
+
+
if (this.name == "Microsoft Internet Explorer") {
this.browser = BrowserVersion.IE;
this.isIE = true;
- if (window.top.SeleniumHTARunner && window.top.document.location.pathname.match(/.hta$/i)) {
- this.isHTA = true;
+ try {
+ if (window.top.SeleniumHTARunner && window.top.document.location.pathname.match(/.hta$/i)) {
+ this.isHTA = true;
+ }
+ } catch (e) {
+ this.isHTADetectable = "no, top location couldn't be read in this window";
+ if (_getQueryParameter('thisIsHTA')) {
+ self.isHTA = true;
+ } else {
+ self.isHTA = false;
+ }
}
if ("0" == navigator.appMinorVersion) {
this.preSV1 = true;
+ if (navigator.appVersion.match(/MSIE 6.0/)) {
+ this.appearsToBeBrokenInitialIE6 = true;
+ }
}
return;
}