Skip to content

Commit a60f72e

Browse files
committed
No more native events in FirefoxDriver, no need to mention them in Java binding.
1 parent d85ff33 commit a60f72e

6 files changed

Lines changed: 12 additions & 92 deletions

File tree

java/client/src/org/openqa/selenium/firefox/FirefoxBinary.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ public void startProfile(FirefoxProfile profile, File profileDir, String... comm
8787
setEnvironmentProperty("NO_EM_RESTART", "1"); // Prevent the binary from detaching from the
8888
// console
8989

90-
if (isOnLinux()
91-
&& (profile.areNativeEventsEnabled() || profile.shouldLoadNoFocusLib())) {
90+
if (isOnLinux() && profile.shouldLoadNoFocusLib()) {
9291
modifyLinkLibraryPath(profileDir);
9392
}
9493

java/client/src/org/openqa/selenium/firefox/FirefoxDriver.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,9 @@ public static final class SystemProperty {
113113
public static final String PROFILE = "firefox_profile";
114114
public static final String MARIONETTE = "marionette";
115115

116+
@Deprecated
116117
// For now, only enable native events on Windows
117-
public static final boolean DEFAULT_ENABLE_NATIVE_EVENTS = Platform.getCurrent().is(WINDOWS);
118+
public static final boolean DEFAULT_ENABLE_NATIVE_EVENTS = false;
118119

119120
// Accept untrusted SSL certificates.
120121
@Deprecated
@@ -195,11 +196,6 @@ static Capabilities populateProfile(FirefoxProfile profile, Capabilities capabil
195196
}
196197
}
197198

198-
if (capabilities.getCapability(HAS_NATIVE_EVENTS) != null) {
199-
Boolean nativeEventsEnabled = (Boolean) capabilities.getCapability(HAS_NATIVE_EVENTS);
200-
profile.setEnableNativeEvents(nativeEventsEnabled);
201-
}
202-
203199
Object rawOptions = capabilities.getCapability(FIREFOX_OPTIONS);
204200
if (rawOptions instanceof Map) {
205201
try {

java/client/src/org/openqa/selenium/firefox/FirefoxProfile.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import static org.openqa.selenium.firefox.FirefoxDriver.ACCEPT_UNTRUSTED_CERTIFICATES;
2121
import static org.openqa.selenium.firefox.FirefoxDriver.ASSUME_UNTRUSTED_ISSUER;
22-
import static org.openqa.selenium.firefox.FirefoxDriver.DEFAULT_ENABLE_NATIVE_EVENTS;
2322

2423
import com.google.common.annotations.VisibleForTesting;
2524
import com.google.common.collect.Maps;
@@ -54,12 +53,10 @@ public class FirefoxProfile {
5453
private Preferences additionalPrefs;
5554

5655
private Map<String, Extension> extensions = Maps.newHashMap();
57-
private boolean enableNativeEvents;
5856
private boolean loadNoFocusLib;
5957
private boolean acceptUntrustedCerts;
6058
private boolean untrustedCertIssuer;
6159
private File model;
62-
private static final String ENABLE_NATIVE_EVENTS_PREF = "webdriver_enable_native_events";
6360
private static final String ACCEPT_UNTRUSTED_CERTS_PREF = "webdriver_accept_untrusted_certs";
6461
private static final String ASSUME_UNTRUSTED_ISSUER_PREF = "webdriver_assume_untrusted_issuer";
6562

@@ -94,15 +91,12 @@ protected FirefoxProfile(Reader defaultsReader, File profileDir) {
9491
if (prefsInModel.exists()) {
9592
StringReader reader = new StringReader("{\"frozen\": {}, \"mutable\": {}}");
9693
Preferences existingPrefs = new Preferences(reader, prefsInModel);
97-
enableNativeEvents = getBooleanPreference(existingPrefs, ENABLE_NATIVE_EVENTS_PREF,
98-
DEFAULT_ENABLE_NATIVE_EVENTS);
9994
acceptUntrustedCerts = getBooleanPreference(existingPrefs, ACCEPT_UNTRUSTED_CERTS_PREF,
10095
ACCEPT_UNTRUSTED_CERTIFICATES);
10196
untrustedCertIssuer = getBooleanPreference(existingPrefs, ASSUME_UNTRUSTED_ISSUER_PREF,
10297
ASSUME_UNTRUSTED_ISSUER);
10398
existingPrefs.addTo(additionalPrefs);
10499
} else {
105-
enableNativeEvents = DEFAULT_ENABLE_NATIVE_EVENTS;
106100
acceptUntrustedCerts = ACCEPT_UNTRUSTED_CERTIFICATES;
107101
untrustedCertIssuer = ASSUME_UNTRUSTED_ISSUER;
108102
}
@@ -278,9 +272,6 @@ public void updateUserPrefs(File userPrefs) {
278272

279273
additionalPrefs.addTo(prefs);
280274

281-
// Should we use native events?
282-
prefs.setPreference(ENABLE_NATIVE_EVENTS_PREF, enableNativeEvents);
283-
284275
// Should we accept untrusted certificates or not?
285276
prefs.setPreference(ACCEPT_UNTRUSTED_CERTS_PREF, acceptUntrustedCerts);
286277

@@ -322,12 +313,19 @@ public void deleteExtensionsCacheIfItExists(File profileDir) {
322313
}
323314
}
324315

316+
@Deprecated
317+
/**
318+
* @deprecated "Native" events are not supported in FirefoxDriver anymore
319+
*/
325320
public boolean areNativeEventsEnabled() {
326-
return enableNativeEvents;
321+
return false;
327322
}
328323

324+
@Deprecated
325+
/**
326+
* @deprecated "Native" events are not supported in FirefoxDriver anymore
327+
*/
329328
public void setEnableNativeEvents(boolean enableNativeEvents) {
330-
this.enableNativeEvents = enableNativeEvents;
331329
}
332330

333331
/**

java/client/test/org/openqa/selenium/firefox/CapabilitiesToProfileTest.java

Lines changed: 0 additions & 44 deletions
This file was deleted.

java/client/test/org/openqa/selenium/firefox/FirefoxSpecificTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
@RunWith(Suite.class)
2828
@Suite.SuiteClasses({
29-
CapabilitiesToProfileTest.class,
3029
ExecutableTest.class,
3130
FirefoxCapabilitiesTest.class,
3231
FirefoxDriverTest.class,

java/client/test/org/openqa/selenium/rc/CopyProfileTest.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,17 @@
2222
import org.junit.Before;
2323
import org.junit.Test;
2424
import org.openqa.selenium.Pages;
25-
import org.openqa.selenium.Platform;
2625
import org.openqa.selenium.WebDriver;
2726
import org.openqa.selenium.environment.GlobalTestEnvironment;
2827
import org.openqa.selenium.environment.InProcessTestEnvironment;
2928
import org.openqa.selenium.environment.TestEnvironment;
3029
import org.openqa.selenium.firefox.FirefoxProfile;
31-
import org.openqa.selenium.remote.CapabilityType;
3230
import org.openqa.selenium.remote.DesiredCapabilities;
3331
import org.openqa.selenium.remote.RemoteWebDriver;
3432
import org.openqa.selenium.testing.Ignore;
3533
import org.openqa.selenium.testing.drivers.OutOfProcessSeleniumServer;
3634

37-
import java.net.MalformedURLException;
38-
3935
import static org.junit.Assert.assertEquals;
40-
import static org.junit.Assert.assertTrue;
41-
import static org.openqa.selenium.Platform.MAC;
4236
import static org.openqa.selenium.firefox.FirefoxDriver.PROFILE;
4337

4438
// TODO(reorg): This test is never run. It must be.
@@ -79,26 +73,4 @@ public void testShouldCopyProfileFromLocalMachineToRemoteInstance() throws Excep
7973
assertEquals(title, "XHTML Test Page", title);
8074
}
8175

82-
@Test
83-
public void testCanEnableNativeEventsOnRemoteFirefox() throws MalformedURLException {
84-
if (Platform.getCurrent().is(MAC)) {
85-
System.out.println("Skipping test: no native events here");
86-
return;
87-
}
88-
89-
FirefoxProfile profile = new FirefoxProfile();
90-
profile.setEnableNativeEvents(true);
91-
92-
DesiredCapabilities caps = DesiredCapabilities.firefox();
93-
caps.setCapability(PROFILE, profile);
94-
95-
RemoteWebDriver driver = new RemoteWebDriver(selenium.getWebDriverUrl(), caps);
96-
97-
Boolean nativeEventsEnabled =
98-
(Boolean) driver.getCapabilities().getCapability(CapabilityType.HAS_NATIVE_EVENTS);
99-
driver.quit();
100-
101-
assertTrue("Native events were explicitly enabled and should be on.",
102-
nativeEventsEnabled);
103-
}
10476
}

0 commit comments

Comments
 (0)