Skip to content

Commit 0cd0b26

Browse files
committed
Firefox: fixing page source for plain text pages
1 parent 628ee86 commit 0cd0b26

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

java/client/test/org/openqa/selenium/TextPagesTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import static org.junit.Assert.assertEquals;
2121
import static org.junit.Assert.fail;
2222
import static org.openqa.selenium.testing.Ignore.Driver.CHROME;
23-
import static org.openqa.selenium.testing.Ignore.Driver.FIREFOX;
2423
import static org.openqa.selenium.testing.Ignore.Driver.IE;
2524
import static org.openqa.selenium.testing.Ignore.Driver.MARIONETTE;
2625
import static org.openqa.selenium.testing.Ignore.Driver.PHANTOMJS;
@@ -41,7 +40,7 @@ public void setUp() throws Exception {
4140
textPage = GlobalTestEnvironment.get().getAppServer().whereIs("plain.txt");
4241
}
4342

44-
@Ignore(value = {IE, FIREFOX, CHROME, SAFARI, PHANTOMJS, MARIONETTE},
43+
@Ignore(value = {IE, CHROME, SAFARI, PHANTOMJS, MARIONETTE},
4544
reason = "IE, Firefox: adds HTML tags.")
4645
@Test
4746
public void testShouldBeAbleToLoadASimplePageOfText() {

javascript/firefox-driver/js/firefoxDriver.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,12 @@ FirefoxDriver.prototype.getPageSource = function(respond) {
384384
return;
385385
}
386386

387+
if (win.document.contentType == "text/plain") {
388+
respond.value = win.document.documentElement.textContent;
389+
respond.send();
390+
return;
391+
}
392+
387393
// Don't pollute the response with annotations we place on the DOM.
388394
docElement.removeAttribute('webdriver');
389395
docElement.removeAttribute('command');

0 commit comments

Comments
 (0)