Bug 1522989 - Only compare URI specs against parsed URI specs; r=mossop
☠☠ backed out by 33ca2ea6b370 ☠ ☠
authorEhsan Akhgari <ehsan@mozilla.com>
Sat, 26 Jan 2019 01:08:35 +0000
changeset 515534 34e24b0fb7b7296e7a4b928dd217b15d2f0d96ac
parent 515533 044a86a4032cf1ab76e4cd43f5d7929fcff0c9a0
child 515535 33ca2ea6b37064d12c0d4fefc81bf689396a5e57
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmossop
bugs1522989
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 1522989 - Only compare URI specs against parsed URI specs; r=mossop Differential Revision: https://phabricator.services.mozilla.com/D17710
browser/components/shell/HeadlessShell.jsm
--- a/browser/components/shell/HeadlessShell.jsm
+++ b/browser/components/shell/HeadlessShell.jsm
@@ -8,38 +8,45 @@ var EXPORTED_SYMBOLS = ["HeadlessShell"]
 
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/osfile.jsm");
 
 // Refrences to the progress listeners to keep them from being gc'ed
 // before they are called.
 const progressListeners = new Map();
 
-function loadContentWindow(webNavigation, uri, principal) {
+function loadContentWindow(webNavigation, url, principal) {
+  let uri;
+  try {
+    uri = Services.io.newURI(url);
+  } catch (e) {
+    Cu.reportError(`Invalid URL passed to loadContentWindow(): ${url}`);
+    return;
+  }
   return new Promise((resolve, reject) => {
     let loadURIOptions = {
       triggeringPrincipal: principal,
     };
-    webNavigation.loadURI(uri, loadURIOptions);
+    webNavigation.loadURI(uri.spec, loadURIOptions);
     let docShell = webNavigation.QueryInterface(Ci.nsIInterfaceRequestor)
                                 .getInterface(Ci.nsIDocShell);
     let webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
                               .getInterface(Ci.nsIWebProgress);
     let progressListener = {
       onLocationChange(progress, request, location, flags) {
         // Ignore inner-frame events
         if (progress != webProgress) {
           return;
         }
         // Ignore events that don't change the document
         if (flags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT) {
           return;
         }
         // Ignore the initial about:blank
-        if (uri != location.spec) {
+        if (uri.spec != location.spec) {
           return;
         }
         let contentWindow = docShell.domWindow;
         progressListeners.delete(progressListener);
         webProgress.removeProgressListener(progressListener);
         contentWindow.addEventListener("load", (event) => {
           resolve(contentWindow);
         }, { once: true });