Bug 1351940 - [marionette] Only convert a valid outerWindowID to a string. r=ato, a=test-only
authorHenrik Skupin <mail@hskupin.info>
Wed, 28 Nov 2018 20:48:42 +0000
changeset 501420 f65cadcba4bd3c4b72ffbd1743279867a9415a3b
parent 501419 19d90b48fffb3382eb0ef3767b7f71f753935c65
child 501421 86447d3b0fa20ec922db7c97719e1c5f3fe1a70c
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato, test-only
bugs1351940
milestone64.0
Bug 1351940 - [marionette] Only convert a valid outerWindowID to a string. r=ato, a=test-only Differential Revision: https://phabricator.services.mozilla.com/D13206
testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/browser/tabbar.py
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/browser/tabbar.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/browser/tabbar.py
@@ -198,21 +198,21 @@ class TabBar(UIBaseLib):
 
         :returns: `handle` of the tab.
         """
         # TODO: This introduces coupling with marionette's window handles
         # implementation. To avoid this, the capacity to get the XUL
         # element corresponding to the active window according to
         # marionette or a similar ability should be added to marionette.
         handle = marionette.execute_script("""
-          let win = arguments[0].linkedBrowser;
-          if (!win) {
+          let browser = arguments[0].linkedBrowser;
+          if (!browser || browser.outerWindowID == null) {
             return null;
           }
-          return win.outerWindowID.toString();
+          return browser.outerWindowID.toString();
         """, script_args=[tab_element])
 
         return handle
 
 
 class Tab(UIBaseLib):
     """Wraps a tab DOM element."""