Skip to content

Commit 62662b6

Browse files
committed
atoms: remove Opera support
Removes Presto-Opera support from Selenium atoms.
1 parent 6e3c7b3 commit 62662b6

16 files changed

+62
-171
lines changed

javascript/atoms/device.js

+5-28
Original file line numberDiff line numberDiff line change
@@ -346,17 +346,6 @@ bot.Device.prototype.getTargetOfOptionMouseEvent_ = function(type) {
346346
}
347347
}
348348

349-
// Opera only skips mouseovers and contextmenus on single selects.
350-
if (goog.userAgent.OPERA) {
351-
switch (type) {
352-
case bot.events.EventType.CONTEXTMENU:
353-
case bot.events.EventType.MOUSEOVER:
354-
return this.select_.multiple ? this.element_ : null;
355-
default:
356-
return this.element_;
357-
}
358-
}
359-
360349
// WebKit always fires on the option element of multi-selects.
361350
// On single-selects, it either fires on the parent or not at all.
362351
if (goog.userAgent.WEBKIT) {
@@ -394,9 +383,9 @@ bot.Device.prototype.clickElement = function(coord, button, opt_force,
394383

395384
// bot.events.fire(element, 'click') can trigger all onclick events, but may
396385
// not follow links (FORM.action or A.href).
397-
// TAG IE GECKO WebKit Opera
398-
// A(href) No No Yes Yes
399-
// FORM(action) No Yes Yes Yes
386+
// TAG IE GECKO WebKit
387+
// A(href) No No Yes
388+
// FORM(action) No Yes Yes
400389
var targetLink = null;
401390
var targetButton = null;
402391
if (!bot.Device.ALWAYS_FOLLOWS_LINKS_ON_CLICK_) {
@@ -498,15 +487,7 @@ bot.Device.prototype.focusOnElement = function() {
498487
// Try to focus on the element.
499488
if (goog.isFunction(elementToFocus.focus) ||
500489
goog.userAgent.IE && goog.isObject(elementToFocus.focus)) {
501-
// Opera fires focus events on hidden elements (e.g. that are hidden after
502-
// mousedown in a click sequence), but as of Opera 11 the focus() command
503-
// does not, so we fire a focus event on the hidden element explicitly.
504-
if (goog.userAgent.OPERA && bot.userAgent.isEngineVersion(11) &&
505-
!bot.dom.isShown(elementToFocus)) {
506-
bot.events.fire(elementToFocus, bot.events.EventType.FOCUS);
507-
} else {
508-
elementToFocus.focus();
509-
}
490+
elementToFocus.focus();
510491
return true;
511492
}
512493

@@ -521,7 +502,7 @@ bot.Device.prototype.focusOnElement = function() {
521502
* @const
522503
*/
523504
bot.Device.ALWAYS_FOLLOWS_LINKS_ON_CLICK_ =
524-
goog.userAgent.WEBKIT || goog.userAgent.OPERA ||
505+
goog.userAgent.WEBKIT ||
525506
(bot.userAgent.FIREFOX_EXTENSION && bot.userAgent.isProductVersion(3.6));
526507

527508

@@ -661,10 +642,6 @@ bot.Device.prototype.toggleRadioButtonOrCheckbox_ = function(wasChecked) {
661642
return;
662643
}
663644
this.element_.checked = !wasChecked;
664-
// Only Opera versions < 11 do not fire the change event themselves.
665-
if (goog.userAgent.OPERA && !bot.userAgent.isEngineVersion(11)) {
666-
bot.events.fire(this.element_, bot.events.EventType.CHANGE);
667-
}
668645
};
669646

670647

javascript/atoms/dom.js

+2-13
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ bot.dom.isInteractable = function(element) {
9494
* @private
9595
*/
9696
bot.dom.hasPointerEventsDisabled_ = function(element) {
97-
if (goog.userAgent.IE || goog.userAgent.OPERA ||
97+
if (goog.userAgent.IE ||
9898
(goog.userAgent.GECKO && !bot.userAgent.isEngineVersion('1.9.2'))) {
9999
// Don't support pointer events
100100
return false;
@@ -216,7 +216,6 @@ bot.dom.SPLIT_STYLE_ATTRIBUTE_ON_SEMICOLONS_REGEXP_ =
216216
* Standardize a style attribute value, which includes:
217217
* (1) converting all property names lowercase
218218
* (2) ensuring it ends in a trailing semi-colon
219-
* (3) removing empty style values (which only appear on Opera).
220219
* @param {string} value The style attribute value.
221220
* @return {string} The identical value, with the formatting rules described
222221
* above applied.
@@ -237,7 +236,7 @@ bot.dom.standardizeStyleAttribute_ = function(value) {
237236
});
238237
css = css.join('');
239238
css = css.charAt(css.length - 1) == ';' ? css : css + ';';
240-
return goog.userAgent.OPERA ? css.replace(/\w+:;/g, '') : css;
239+
return css;
241240
};
242241

243242

@@ -884,16 +883,6 @@ bot.dom.getClientRect = function(elem) {
884883
rect.top -= doc.documentElement.clientTop + doc.body.clientTop;
885884
}
886885

887-
// Opera sometimes falsely report zero size bounding rects.
888-
if (goog.userAgent.OPERA) {
889-
if (rect.width == 0 && elem.offsetWidth > 0) {
890-
rect.width = elem.offsetWidth;
891-
}
892-
if (rect.height == 0 && elem.offsetHeight > 0) {
893-
rect.height = elem.offsetHeight;
894-
}
895-
}
896-
897886
// On Gecko < 12, getBoundingClientRect does not account for CSS transforms.
898887
// TODO: Remove this when we drop support for FF3.6 and FF10.
899888
if (goog.userAgent.GECKO && !bot.userAgent.isEngineVersion(12)) {

javascript/atoms/events.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ goog.require('goog.userAgent.product');
4646
* @type {boolean}
4747
*/
4848
bot.events.SUPPORTS_TOUCH_EVENTS = !(goog.userAgent.IE &&
49-
!bot.userAgent.isEngineVersion(10)) &&
50-
!goog.userAgent.OPERA;
49+
!bot.userAgent.isEngineVersion(10));
5150

5251

5352
/**
@@ -334,13 +333,13 @@ bot.events.MouseEventFactory_.prototype.create = function(target, opt_args) {
334333
// All browser but Firefox provide the wheelDelta value in the event.
335334
// Firefox provides the scroll amount in the detail field, where it has the
336335
// opposite polarity of the wheelDelta (upward scroll is negative) and is a
337-
// factor of 40 less than the wheelDelta value. Opera provides both values.
336+
// factor of 40 less than the wheelDelta value.
338337
// The wheelDelta value is normally some multiple of 40.
339338
if (this == bot.events.EventType.MOUSEWHEEL) {
340339
if (!goog.userAgent.GECKO) {
341340
event.wheelDelta = args.wheelDelta;
342341
}
343-
if (goog.userAgent.GECKO || goog.userAgent.OPERA) {
342+
if (goog.userAgent.GECKO) {
344343
detail = args.wheelDelta / -40;
345344
}
346345
}
@@ -424,7 +423,7 @@ bot.events.KeyboardEventFactory_.prototype.create = function(target, opt_args) {
424423
} else {
425424
if (bot.userAgent.IE_DOC_PRE9) {
426425
event = doc.createEventObject();
427-
} else { // WebKit, Opera, and IE 9+ in Standards mode.
426+
} else { // WebKit and IE 9+ in Standards mode.
428427
event = doc.createEvent('Events');
429428
event.initEvent(this.type_, this.bubbles_, this.cancelable_);
430429
}

javascript/atoms/json.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ bot.json.NATIVE_JSON = true;
4747
* @private {boolean}
4848
*/
4949
bot.json.SUPPORTS_NATIVE_JSON_ =
50-
// List WebKit and Opera first since every supported version of these
51-
// browsers supports native JSON (and we can compile away large chunks of
52-
// code for individual fragments by setting the appropriate compiler flags).
53-
goog.userAgent.WEBKIT || goog.userAgent.OPERA ||
50+
// List WebKit first since every supported version supports
51+
// native JSON (and we can compile away large chunks of code for
52+
// individual fragments by setting the appropriate compiler flags).
53+
goog.userAgent.WEBKIT ||
5454
(goog.userAgent.GECKO && bot.userAgent.isEngineVersion(3.5)) ||
5555
(goog.userAgent.IE && bot.userAgent.isEngineVersion(8));
5656

javascript/atoms/keyboard.js

+33-37
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ bot.Keyboard.CHAR_TO_KEY_ = {};
9191
* of the new keyword, also helps reduce the size of the compiled Js fragment.
9292
*
9393
* @param {null|number|
94-
* {gecko: (?number), ieWebkit: (?number), opera: (?number)}} code
94+
* {gecko: (?number), ieWebkit: (?number)}} code
9595
* Either a single keycode or a record of per-browser keycodes.
9696
* @param {string=} opt_char Character when shift is not pressed.
9797
* @param {string=} opt_shiftChar Character when shift is pressed.
@@ -102,8 +102,6 @@ bot.Keyboard.newKey_ = function(code, opt_char, opt_shiftChar) {
102102
if (goog.isObject(code)) {
103103
if (goog.userAgent.GECKO) {
104104
code = code.gecko;
105-
} else if (goog.userAgent.OPERA) {
106-
code = code.opera;
107105
} else { // IE and Webkit
108106
code = code.ieWebkit;
109107
}
@@ -219,41 +217,40 @@ bot.Keyboard.Keys = {
219217

220218
// Branded keys
221219
META: bot.Keyboard.newKey_(
222-
goog.userAgent.WINDOWS ? {gecko: 91, ieWebkit: 91, opera: 219} :
223-
(goog.userAgent.MAC ? {gecko: 224, ieWebkit: 91, opera: 17} :
224-
{gecko: 0, ieWebkit: 91, opera: null})), // Linux
220+
goog.userAgent.WINDOWS ? {gecko: 91, ieWebkit: 91} :
221+
(goog.userAgent.MAC ? {gecko: 224, ieWebkit: 91} :
222+
{gecko: 0, ieWebkit: 91})), // Linux
225223
META_RIGHT: bot.Keyboard.newKey_(
226-
goog.userAgent.WINDOWS ? {gecko: 92, ieWebkit: 92, opera: 220} :
227-
(goog.userAgent.MAC ? {gecko: 224, ieWebkit: 93, opera: 17} :
228-
{gecko: 0, ieWebkit: 92, opera: null})), // Linux
224+
goog.userAgent.WINDOWS ? {gecko: 92, ieWebkit: 92} :
225+
(goog.userAgent.MAC ? {gecko: 224, ieWebkit: 93} :
226+
{gecko: 0, ieWebkit: 92})), // Linux
229227
CONTEXT_MENU: bot.Keyboard.newKey_(
230-
goog.userAgent.WINDOWS ? {gecko: 93, ieWebkit: 93, opera: 0} :
231-
(goog.userAgent.MAC ? {gecko: 0, ieWebkit: 0, opera: 16} :
232-
{gecko: 93, ieWebkit: null, opera: 0})), // Linux
228+
goog.userAgent.WINDOWS ? {gecko: 93, ieWebkit: 93} :
229+
(goog.userAgent.MAC ? {gecko: 0, ieWebkit: 0} :
230+
{gecko: 93, ieWebkit: null})), // Linux
233231

234232
// Numpad keys
235-
NUM_ZERO: bot.Keyboard.newKey_({gecko: 96, ieWebkit: 96, opera: 48}, '0'),
236-
NUM_ONE: bot.Keyboard.newKey_({gecko: 97, ieWebkit: 97, opera: 49}, '1'),
237-
NUM_TWO: bot.Keyboard.newKey_({gecko: 98, ieWebkit: 98, opera: 50}, '2'),
238-
NUM_THREE: bot.Keyboard.newKey_({gecko: 99, ieWebkit: 99, opera: 51}, '3'),
239-
NUM_FOUR: bot.Keyboard.newKey_({gecko: 100, ieWebkit: 100, opera: 52}, '4'),
240-
NUM_FIVE: bot.Keyboard.newKey_({gecko: 101, ieWebkit: 101, opera: 53}, '5'),
241-
NUM_SIX: bot.Keyboard.newKey_({gecko: 102, ieWebkit: 102, opera: 54}, '6'),
242-
NUM_SEVEN: bot.Keyboard.newKey_({gecko: 103, ieWebkit: 103, opera: 55}, '7'),
243-
NUM_EIGHT: bot.Keyboard.newKey_({gecko: 104, ieWebkit: 104, opera: 56}, '8'),
244-
NUM_NINE: bot.Keyboard.newKey_({gecko: 105, ieWebkit: 105, opera: 57}, '9'),
233+
NUM_ZERO: bot.Keyboard.newKey_({gecko: 96, ieWebkit: 96}, '0'),
234+
NUM_ONE: bot.Keyboard.newKey_({gecko: 97, ieWebkit: 97}, '1'),
235+
NUM_TWO: bot.Keyboard.newKey_({gecko: 98, ieWebkit: 98}, '2'),
236+
NUM_THREE: bot.Keyboard.newKey_({gecko: 99, ieWebkit: 99}, '3'),
237+
NUM_FOUR: bot.Keyboard.newKey_({gecko: 100, ieWebkit: 100}, '4'),
238+
NUM_FIVE: bot.Keyboard.newKey_({gecko: 101, ieWebkit: 101}, '5'),
239+
NUM_SIX: bot.Keyboard.newKey_({gecko: 102, ieWebkit: 102}, '6'),
240+
NUM_SEVEN: bot.Keyboard.newKey_({gecko: 103, ieWebkit: 103}, '7'),
241+
NUM_EIGHT: bot.Keyboard.newKey_({gecko: 104, ieWebkit: 104}, '8'),
242+
NUM_NINE: bot.Keyboard.newKey_({gecko: 105, ieWebkit: 105}, '9'),
245243
NUM_MULTIPLY: bot.Keyboard.newKey_(
246-
{gecko: 106, ieWebkit: 106, opera: goog.userAgent.LINUX ? 56 : 42}, '*'),
244+
{gecko: 106, ieWebkit: 106}, '*'),
247245
NUM_PLUS: bot.Keyboard.newKey_(
248-
{gecko: 107, ieWebkit: 107, opera: goog.userAgent.LINUX ? 61 : 43}, '+'),
246+
{gecko: 107, ieWebkit: 107}, '+'),
249247
NUM_MINUS: bot.Keyboard.newKey_(
250-
{gecko: 109, ieWebkit: 109, opera: goog.userAgent.LINUX ? 109 : 45}, '-'),
248+
{gecko: 109, ieWebkit: 109}, '-'),
251249
NUM_PERIOD: bot.Keyboard.newKey_(
252-
{gecko: 110, ieWebkit: 110, opera: goog.userAgent.LINUX ? 190 : 78}, '.'),
250+
{gecko: 110, ieWebkit: 110}, '.'),
253251
NUM_DIVISION: bot.Keyboard.newKey_(
254-
{gecko: 111, ieWebkit: 111, opera: goog.userAgent.LINUX ? 191 : 47}, '/'),
255-
NUM_LOCK: bot.Keyboard.newKey_(
256-
(goog.userAgent.LINUX && goog.userAgent.OPERA) ? null : 144),
252+
{gecko: 111, ieWebkit: 111}, '/'),
253+
NUM_LOCK: bot.Keyboard.newKey_(144),
257254

258255
// Function keys
259256
F1: bot.Keyboard.newKey_(112),
@@ -271,10 +268,10 @@ bot.Keyboard.Keys = {
271268

272269
// Punctuation keys
273270
EQUALS: bot.Keyboard.newKey_(
274-
{gecko: 107, ieWebkit: 187, opera: 61}, '=', '+'),
271+
{gecko: 107, ieWebkit: 187}, '=', '+'),
275272
SEPARATOR: bot.Keyboard.newKey_(108, ','),
276273
HYPHEN: bot.Keyboard.newKey_(
277-
{gecko: 109, ieWebkit: 189, opera: 109}, '-', '_'),
274+
{gecko: 109, ieWebkit: 189}, '-', '_'),
278275
COMMA: bot.Keyboard.newKey_(188, ',', '<'),
279276
PERIOD: bot.Keyboard.newKey_(190, '.', '>'),
280277
SLASH: bot.Keyboard.newKey_(191, '/', '?'),
@@ -283,7 +280,7 @@ bot.Keyboard.Keys = {
283280
BACKSLASH: bot.Keyboard.newKey_(220, '\\', '|'),
284281
CLOSE_BRACKET: bot.Keyboard.newKey_(221, ']', '}'),
285282
SEMICOLON: bot.Keyboard.newKey_(
286-
{gecko: 59, ieWebkit: 186, opera: 59}, ';', ':'),
283+
{gecko: 59, ieWebkit: 186}, ';', ':'),
287284
APOSTROPHE: bot.Keyboard.newKey_(222, '\'', '"')
288285
};
289286

@@ -392,13 +389,12 @@ bot.Keyboard.prototype.setKeyPressed_ = function(key, isPressed) {
392389

393390
/**
394391
* The value used for newlines in the current browser/OS combination. Although
395-
* the line endings look platform dependent, they are browser dependent. In
396-
* particular, Opera uses \r\n on all platforms.
392+
* the line endings look platform dependent, they are browser dependent.
393+
*
397394
* @private {string}
398395
* @const
399396
*/
400-
bot.Keyboard.NEW_LINE_ =
401-
goog.userAgent.IE || goog.userAgent.OPERA ? '\r\n' : '\n';
397+
bot.Keyboard.NEW_LINE_ = goog.userAgent.IE ? '\r\n' : '\n';
402398

403399

404400
/**
@@ -465,7 +461,7 @@ bot.Keyboard.prototype.requiresKeyPress_ = function(key) {
465461
return false;
466462
} else if (goog.userAgent.IE) {
467463
return key == bot.Keyboard.Keys.ESC;
468-
} else { // Gecko and Opera
464+
} else { // Gecko
469465
switch (key) {
470466
case bot.Keyboard.Keys.SHIFT:
471467
case bot.Keyboard.Keys.CONTROL:

javascript/atoms/locators/xpath.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,7 @@ bot.locators.xpath.single = function(target, root) {
191191

192192
if (result) {
193193
var node = result.singleNodeValue;
194-
// On Opera, a singleNodeValue of undefined indicates a type error, while
195-
// other browsers may use it to indicate something has not been found.
196-
return goog.userAgent.OPERA ? node : (node || null);
194+
return node || null;
197195
} else if (root.selectSingleNode) {
198196
var doc = goog.dom.getOwnerDocument(root);
199197
if (doc.setProperty) {
@@ -226,11 +224,6 @@ bot.locators.xpath.many = function(target, root) {
226224
bot.locators.XPathResult_.ORDERED_NODE_SNAPSHOT_TYPE);
227225
if (result) {
228226
var count = result.snapshotLength;
229-
// On Opera, if the XPath evaluates to a non-Node value, snapshotLength
230-
// will be undefined and the result empty, so fail immediately.
231-
if (goog.userAgent.OPERA && !goog.isDef(count)) {
232-
bot.locators.xpath.checkElement_(null, target);
233-
}
234227
var results = [];
235228
for (var i = 0; i < count; ++i) {
236229
results.push(result.snapshotItem(i));

javascript/atoms/mouse.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ bot.Mouse.NO_BUTTON_VALUE_INDEX_ = 3;
142142
* dblclick mousedown mouseover
143143
* IE_DOC_PRE9 0 0 0 X 1 4 2 X 0 0 0 0 1 4 2 0 X X 0 X
144144
* WEBKIT/IE9 0 1 2 X 0 1 2 X 0 1 2 0 0 1 2 0 X X 2 X
145-
* GECKO/OPERA 0 1 2 X 0 1 2 X 0 0 0 0 0 0 0 0 X X 2 X
145+
* GECKO 0 1 2 X 0 1 2 X 0 0 0 0 0 0 0 0 X X 2 X
146146
* </pre>
147147
* @private {!Object.<bot.events.EventType, !Array.<?number>>}
148148
* @const

javascript/atoms/test/click_test.html

+1-6
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,6 @@
270270
expectedEvents = goog.array.slice(clickEvents, 0, i + 1);
271271
}
272272

273-
// Opera fires a focus event when the element is hidden on mousedown.
274-
if (goog.userAgent.OPERA && hideOn == goog.events.EventType.MOUSEDOWN) {
275-
expectedEvents.push(goog.events.EventType.FOCUS);
276-
}
277-
278273
// If we expect a focus event, only test if the window is focused.
279274
if (!goog.array.contains(expectedEvents, goog.events.EventType.FOCUS) ||
280275
bot.test.isWindowFocused()) {
@@ -369,7 +364,7 @@
369364
shouldBeAbleToClickOnElementsWithOpacityZero, bot.action.tap);
370365

371366
function shouldNotBeAbleToClickOnElementWithPointerEventsNone(action) {
372-
if (!checkActionCompatibility(action) || goog.userAgent.IE || goog.userAgent.OPERA ||
367+
if (!checkActionCompatibility(action) || goog.userAgent.IE ||
373368
(goog.userAgent.GECKO && !bot.userAgent.isEngineVersion('1.9.2'))) {
374369
return;
375370
}

0 commit comments

Comments
 (0)