Bug 1510695 - Fix URL comparisons when loading reftests r=jgraham
authorGeoffrey Sneddon <me@gsnedders.com>
Fri, 11 Jan 2019 18:11:34 +0000
changeset 453513 0655bfda512a0f795754f830dbe6a37e1f3bbbab
parent 453512 ea7ab7f59caa6b655e117775a5816625acf7060a
child 453514 0a9c477577dec9ab7b8f4bf6e424e1c19f4db256
push id35357
push usernerli@mozilla.com
push dateFri, 11 Jan 2019 21:54:07 +0000
treeherdermozilla-central@0ce024c91511 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgraham
bugs1510695
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1510695 - Fix URL comparisons when loading reftests r=jgraham Depends on D13281 Differential Revision: https://phabricator.services.mozilla.com/D13282
testing/marionette/harness/marionette_harness/tests/unit/test_reftest.py
testing/marionette/listener.js
testing/marionette/reftest.js
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_reftest.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_reftest.py
@@ -40,8 +40,21 @@ class TestReftest(MarionetteTestCase):
                                             "expected": "PASS",
                                             "timeout": 10 * 1000})
         self.marionette._send_message("reftest:teardown", {})
         expected = {u'value': {u'extra': {},
                                u'message': u'Testing about:blank == about:blank\n',
                                u'stack': None,
                                u'status': u'PASS'}}
         self.assertEqual(expected, rv)
+
+    def test_url_comparison(self):
+        test_page = self.fixtures.where_is("test.html")
+        test_page_2 = self.fixtures.where_is("foo/../test.html")
+
+        self.marionette._send_message("reftest:setup", {"screenshot": "unexpected"})
+        rv = self.marionette._send_message("reftest:run",
+                                           {"test": test_page,
+                                            "references": [[test_page_2, [], "=="]],
+                                            "expected": "PASS",
+                                            "timeout": 10 * 1000})
+        self.marionette._send_message("reftest:teardown", {})
+        self.assertEqual(u"PASS", rv[u"value"][u"status"])
--- a/testing/marionette/listener.js
+++ b/testing/marionette/listener.js
@@ -1633,16 +1633,17 @@ async function reftestWait(url, remote) 
           win.setTimeout(resolve, 0);
         }
       };
       addEventListener("load", maybeResolve, true);
     });
   } else {
     // Ensure that the event loop has spun at least once since load,
     // so that setTimeout(fn, 0) in the load event has run
+    logger.debug("Waiting for event loop to spin");
     reftestWait = document.documentElement.classList.contains("reftest-wait");
     await new Promise(resolve => win.setTimeout(resolve, 0));
   }
 
   let root = document.documentElement;
   if (reftestWait) {
     // Check again in case reftest-wait was removed since the load event
     if (root.classList.contains("reftest-wait")) {
--- a/testing/marionette/reftest.js
+++ b/testing/marionette/reftest.js
@@ -454,16 +454,17 @@ max-width: ${REFTEST_WIDTH}px; max-heigh
           win.innerWidth >= browserRect.width &&
           win.innerHeight >= browserRect.height) {
         logger.debug("Using DRAWWINDOW_USE_WIDGET_LAYERS");
         flags |= ctxInterface.DRAWWINDOW_USE_WIDGET_LAYERS;
       } else {
         logger.debug("Not using DRAWWINDOW_USE_WIDGET_LAYERS");
       }
 
+      url = new URL(url).href; // normalize the URL
       logger.debug(`Starting load of ${url}`);
       let navigateOpts = {
         commandId: this.driver.listener.activeMessageId,
         pageTimeout: timeout,
       };
       if (this.lastURL === url) {
         logger.debug(`Refreshing page`);
         await this.driver.listener.refresh(navigateOpts);