Bug 1243415 - Check for a valid DOMWindow for screenshot in chrome scope. r=automatedtester

By the webdriver spec the code has to fail with a NoSuchWindowError if the
active window is no longer present.

MozReview-Commit-ID: HFl7yO5ErRn

--HG--
extra : rebase_source : 8d8271751a4cffdf4e74d4e66ff71588e7d2a01e
This commit is contained in:
Henrik Skupin 2016-12-07 21:47:44 +01:00
Родитель 42387e6802
Коммит 53c4ccf6d0
1 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -2408,9 +2408,14 @@ GeckoDriver.prototype.takeScreenshot = function (cmd, resp) {
switch (this.context) {
case Context.CHROME:
let canvas;
let container = {frame: this.getCurrentWindow()};
let highlightEls = [];
let container = {frame: this.getCurrentWindow().document.defaultView};
if (!container.frame) {
throw new NoSuchWindowError('Unable to locate window');
}
for (let h of highlights) {
let el = this.curBrowser.seenEls.get(h, container);
highlightEls.push(el);