зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1103196 - Error on encountering invalid certificate; r=automatedtester
When arriving at a document which baseURI starts with `about:certerror` will cause Marionette to now return `error.InsecureCertificateError`. This is mandated by the WebDriver specification. This does, however, mark a non-backwards compatible change in Marionette. It is assumed we will be able to mitigate this change in error type as few consumers, if any, rely on the more generic type considering we did not support invalid TLS certificates prior to this push. MozReview-Commit-ID: JcIMvCXimB --HG-- extra : rebase_source : 5e2dffe8e5d16ae3fe407ed42c43d52b49e3741d
This commit is contained in:
Родитель
9ac8f3690e
Коммит
5c6b5dd771
|
@ -1413,17 +1413,22 @@ GeckoDriver.prototype.switchToParentFrame = function*(cmd, resp) {
|
|||
GeckoDriver.prototype.switchToFrame = function*(cmd, resp) {
|
||||
let {id, element, focus} = cmd.parameters;
|
||||
|
||||
let checkTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
const otherErrorsExpr = /about:.+(error)|(blocked)\?/;
|
||||
const checkTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
|
||||
let curWindow = this.getCurrentWindow();
|
||||
|
||||
let checkLoad = function() {
|
||||
let errorRegex = /about:.+(error)|(blocked)\?/;
|
||||
let curWindow = this.getCurrentWindow();
|
||||
if (curWindow.document.readyState == "complete") {
|
||||
let win = this.getCurrentWindow();
|
||||
if (win.document.readyState == "complete") {
|
||||
return;
|
||||
} else if (curWindow.document.readyState == "interactive" &&
|
||||
errorRegex.exec(curWindow.document.baseURI)) {
|
||||
throw new UnknownError("Error loading page");
|
||||
} else if (win.document.readyState == "interactive") {
|
||||
let baseURI = win.document.baseURI;
|
||||
if (baseURI.startsWith("about:certerror")) {
|
||||
throw new InsecureCertificateError();
|
||||
} else if (otherErrorsExpr.exec(win.document.baseURI)) {
|
||||
throw new UnknownError("Error loading page");
|
||||
}
|
||||
}
|
||||
|
||||
checkTimer.initWithCallback(checkLoad.bind(this), 100, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||
|
|
|
@ -875,10 +875,15 @@ function pollForReadyState(msg, start = undefined, callback = undefined) {
|
|||
callback();
|
||||
sendOk(command_id);
|
||||
|
||||
// document with an insecure cert
|
||||
} else if (doc.readyState == "interactive" &&
|
||||
doc.baseURI.startsWith("about:certerror")) {
|
||||
callback();
|
||||
sendError(new InsecureCertificateError(), command_id);
|
||||
|
||||
// we have reached an error url without requesting it
|
||||
} else if (doc.readyState == "interactive" &&
|
||||
/about:.+(error)\?/.exec(doc.baseURI) &&
|
||||
!doc.baseURI.startsWith(url)) {
|
||||
/about:.+(error)\?/.exec(doc.baseURI)) {
|
||||
callback();
|
||||
sendError(new UnknownError("Reached error page: " + doc.baseURI), command_id);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче