Bug 1374672 - Use documentURI instead of baseURI. r=automatedtester

baseURI isn't actually we have to check for to get the
current documents URI. Therefore documentURI exists.

MozReview-Commit-ID: CDhOZ8lU2qJ

--HG--
extra : rebase_source : c53f79468a7d319bd5e7aa40338fce0ca7299bd4
This commit is contained in:
Henrik Skupin 2017-07-07 15:36:08 +02:00
parent 2108ee3e4e
commit 2ae312826e
2 changed files with 9 additions and 9 deletions

View File

@ -1629,11 +1629,11 @@ GeckoDriver.prototype.switchToFrame = function* (cmd, resp) {
if (win.document.readyState == "complete") {
return;
} else if (win.document.readyState == "interactive") {
let baseURI = win.document.baseURI;
if (baseURI.startsWith("about:certerror")) {
let documentURI = win.document.documentURI;
if (documentURI.startsWith("about:certerror")) {
throw new InsecureCertificateError();
} else if (otherErrorsExpr.exec(win.document.baseURI)) {
throw new UnknownError("Error loading page");
} else if (otherErrorsExpr.exec(documentURI)) {
throw new UnknownError("Reached error page: " + documentURI);
}
}

View File

@ -222,7 +222,7 @@ var loadListener = {
* Callback for registered DOM events.
*/
handleEvent(event) {
let location = event.target.baseURI || event.target.location.href;
let location = event.target.documentURI || event.target.location.href;
logger.debug(`Received DOM event "${event.type}" for "${location}"`);
switch (event.type) {
@ -255,21 +255,21 @@ var loadListener = {
break;
case "DOMContentLoaded":
if (event.target.baseURI.startsWith("about:certerror")) {
if (event.target.documentURI.startsWith("about:certerror")) {
this.stop();
sendError(new InsecureCertificateError(), this.command_id);
} else if (/about:.*(error)\?/.exec(event.target.baseURI)) {
} else if (/about:.*(error)\?/.exec(event.target.documentURI)) {
this.stop();
sendError(new UnknownError("Reached error page: " +
event.target.baseURI), this.command_id);
event.target.documentURI), this.command_id);
// Return early with a page load strategy of eager, and also
// special-case about:blocked pages which should be treated as
// non-error pages but do not raise a pageshow event.
} else if ((capabilities.get("pageLoadStrategy") ===
session.PageLoadStrategy.Eager) ||
/about:blocked\?/.exec(event.target.baseURI)) {
/about:blocked\?/.exec(event.target.documentURI)) {
this.stop();
sendOk(this.command_id);
}