Skip to content

Commit

Permalink
javascript/webdriver: remove Opera support
Browse files Browse the repository at this point in the history
  • Loading branch information
andreastt committed Feb 28, 2015
1 parent c049af9 commit af8b8ee
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 109 deletions.
2 changes: 1 addition & 1 deletion javascript/webdriver/atoms/element.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ goog.require('webdriver.Key');
*/
webdriver.atoms.element.isSelected = function(element) {
// Although this method looks unloved, its compiled form is used by
// the Chrome and OperaDrivers.
// Chrome.
if (!bot.dom.isSelectable(element)) {
return false;
}
Expand Down
1 change: 0 additions & 1 deletion javascript/webdriver/browser/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ webdriver.browser.BROWSER_NAME_ = (function() {
map[goog.userAgent.IE] = webdriver.Browser.INTERNET_EXPLORER;
map[goog.userAgent.product.IPAD] = webdriver.Browser.IPAD;
map[goog.userAgent.product.IPHONE] = webdriver.Browser.IPHONE;
map[goog.userAgent.OPERA] = webdriver.Browser.OPERA;
map[goog.userAgent.product.SAFARI] = webdriver.Browser.SAFARI;
return map[true] || '';
})();
Expand Down
10 changes: 0 additions & 10 deletions javascript/webdriver/capabilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ webdriver.Browser = {
INTERNET_EXPLORER: 'internet explorer',
IPAD: 'iPad',
IPHONE: 'iPhone',
OPERA: 'opera',
PHANTOM_JS: 'phantomjs',
SAFARI: 'safari',
HTMLUNIT: 'htmlunit'
Expand Down Expand Up @@ -237,15 +236,6 @@ webdriver.Capabilities.iphone = function() {
};


/**
* @return {!webdriver.Capabilities} A basic set of capabilities for Opera.
*/
webdriver.Capabilities.opera = function() {
return new webdriver.Capabilities().
set(webdriver.Capability.BROWSER_NAME, webdriver.Browser.OPERA);
};


/**
* @return {!webdriver.Capabilities} A basic set of capabilities for
* PhantomJS.
Expand Down
6 changes: 3 additions & 3 deletions javascript/webdriver/http/corsclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ goog.require('webdriver.http.Response');
* This limitation appears to be intentional and is documented in WebKit's
* Layout tests:
* //LayoutTests/http/tests/xmlhttprequest/access-control-and-redirects.html
* <li>If the server does not return a 2xx response, IE and Opera's
* implementations will fire the XDomainRequest/XMLHttpRequest object's
* <li>If the server does not return a 2xx response, IE
* implementation will fire the XDomainRequest/XMLHttpRequest object's
* onerror handler, but without the corresponding response text returned by
* the server. This renders IE and Opera incapable of handling command
* the server. This renders IE incapable of handling command
* failures in the standard JSON protocol.
* </ul>
*
Expand Down
49 changes: 2 additions & 47 deletions javascript/webdriver/stacktrace.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ webdriver.stacktrace.Snapshot = function(opt_slice) {
}

/**
* The error's stacktrace. This must be accessed immediately to ensure Opera
* computes the context correctly.
* The error's stacktrace.
* @private {string}
*/
this.stack_ = webdriver.stacktrace.getStack(error);
Expand Down Expand Up @@ -392,40 +391,6 @@ webdriver.stacktrace.FIREFOX_STACK_FRAME_REGEXP_ = new RegExp('^' +
'(?::0|' + webdriver.stacktrace.URL_PATTERN_ + ')$');


/**
* RegExp pattern for an anonymous function call in an Opera stack frame.
* Creates 2 (optional) submatches: the context object and function name.
* @private {string}
* @const
*/
webdriver.stacktrace.OPERA_ANONYMOUS_FUNCTION_NAME_PATTERN_ =
'<anonymous function(?:\\: ' +
webdriver.stacktrace.QUALIFIED_NAME_PATTERN_ + ')?>';


/**
* RegExp pattern for a function call in an Opera stack frame.
* Creates 3 (optional) submatches: the function name (if not anonymous),
* the aliased context object and the function name (if anonymous).
* @private {string}
* @const
*/
webdriver.stacktrace.OPERA_FUNCTION_CALL_PATTERN_ =
'(?:(?:(' + webdriver.stacktrace.IDENTIFIER_PATTERN_ + ')|' +
webdriver.stacktrace.OPERA_ANONYMOUS_FUNCTION_NAME_PATTERN_ +
')(?:\\(.*\\)))?@';


/**
* Regular expression for parsing on stack frame in Opera 11.68+
* @private {!RegExp}
* @const
*/
webdriver.stacktrace.OPERA_STACK_FRAME_REGEXP_ = new RegExp('^' +
webdriver.stacktrace.OPERA_FUNCTION_CALL_PATTERN_ +
webdriver.stacktrace.URL_PATTERN_ + '?$');


/**
* RegExp pattern for function call in a Chakra (IE) stack trace. This
* expression creates 2 submatches on the (optional) context and function name,
Expand Down Expand Up @@ -516,11 +481,6 @@ webdriver.stacktrace.parseStackFrame_ = function(frameStr) {
return new webdriver.stacktrace.Frame('', m[1], '', m[2]);
}

m = frameStr.match(webdriver.stacktrace.OPERA_STACK_FRAME_REGEXP_);
if (m) {
return new webdriver.stacktrace.Frame(m[2], m[1] || m[3], '', m[4]);
}

m = frameStr.match(webdriver.stacktrace.CHAKRA_STACK_FRAME_REGEXP_);
if (m) {
return new webdriver.stacktrace.Frame(m[1], m[2], '', m[3]);
Expand Down Expand Up @@ -641,12 +601,7 @@ webdriver.stacktrace.parse_ = function(stack) {
// The first two frames will be:
// webdriver.stacktrace.Snapshot()
// webdriver.stacktrace.get()
// In the case of Opera, sometimes an extra frame is injected in the next
// frame with a reported line number of zero. The next line detects that
// case and skips that frame.
if (!(goog.userAgent.OPERA && i == 2 && frame.getLine() == 0)) {
frames.push(frame || webdriver.stacktrace.ANONYMOUS_FRAME_);
}
frames.push(frame || webdriver.stacktrace.ANONYMOUS_FRAME_);
}
return frames;
};
Expand Down
47 changes: 0 additions & 47 deletions javascript/webdriver/test/stacktrace_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,53 +174,6 @@ function testParseStackFrameInV8() {
'/local/dir/path'));
}

function testParseStackFrameInOpera() {
assertStackFrame('empty frame', '@', webdriver.stacktrace.ANONYMOUS_FRAME_);

assertStackFrame('javascript path only',
'@javascript:console.log(Error().stack):1',
new webdriver.stacktrace.Frame('', '', '',
'javascript:console.log(Error().stack):1'));

assertStackFrame('path only',
'@file:///foo:42',
new webdriver.stacktrace.Frame('', '', '', 'file:///foo:42'));

// (function go() { throw Error() })()
// var c = go; c()
assertStackFrame('name and empty path',
'go([arguments not available])@',
new webdriver.stacktrace.Frame('', 'go', '', ''));

assertStackFrame('name and path',
'go([arguments not available])@file:///foo:42',
new webdriver.stacktrace.Frame('', 'go', '', 'file:///foo:42'));

// (function() { throw Error() })()
assertStackFrame('anonymous function',
'<anonymous function>([arguments not available])@file:///foo:42',
new webdriver.stacktrace.Frame('', '', '', 'file:///foo:42'));

// var b = {foo: function() { throw Error() }}
assertStackFrame('object literal function',
'<anonymous function: foo>()@file:///foo:42',
new webdriver.stacktrace.Frame('', 'foo', '', 'file:///foo:42'));

// var c = {}; c.foo = function() { throw Error() }
assertStackFrame('named object literal function',
'<anonymous function: c.foo>()@file:///foo:42',
new webdriver.stacktrace.Frame('c', 'foo', '', 'file:///foo:42'));

assertStackFrame('prototype function',
'<anonymous function: Foo.prototype.bar>()@',
new webdriver.stacktrace.Frame('Foo.prototype', 'bar', '', ''));

assertStackFrame('namespaced prototype function',
'<anonymous function: goog.Foo.prototype.bar>()@',
new webdriver.stacktrace.Frame(
'goog.Foo.prototype', 'bar', '', ''));
}

function testParseClosureCanonicalStackFrame() {
assertStackFrame('unknown frame', '> (unknown)',
webdriver.stacktrace.ANONYMOUS_FRAME_);
Expand Down

3 comments on commit af8b8ee

@mathiasbynens
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Opera Presto support is dropped, why not add support for Opera Chromium? https://github.com/operasoftware/operachromiumdriver

@andreastt
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit removes Presto support in the Selenium JavaScript atoms. UA specific code for Chromium-Opera should be handled by the Chrome conditions, since all this file cares about is which rendering engine is being used.

@mathiasbynens
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying!

Please sign in to comment.