diff options
author | wei <> | 2007-03-25 23:19:26 +0000 |
---|---|---|
committer | wei <> | 2007-03-25 23:19:26 +0000 |
commit | 9e52d1ddac7fd4e54c0744a00aae6786081267af (patch) | |
tree | 9ca408975a9a7c9f623e874d7804e6d2fb82975c /tests/test_tools/selenium/core/scripts/selenium-browserdetect.js | |
parent | c9c31d6edb91e22c56ffab3772ce8a29b1480537 (diff) |
Update Selenium to 0.8.2
Diffstat (limited to 'tests/test_tools/selenium/core/scripts/selenium-browserdetect.js')
-rw-r--r-- | tests/test_tools/selenium/core/scripts/selenium-browserdetect.js | 48 |
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; } |