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 : d170e400c1624e680745e7023041413055ef9bd0
This commit is contained in:
Henrik Skupin 2016-12-07 21:47:44 +01:00
parent c4fb446f19
commit f68eddf3dd

View File

@ -2413,9 +2413,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);