Bug 1292522 - Fix regression from bug 409885. r=smaug a=lizzard
authorDragana Damjanovic <dd.mozilla@gmail.com>
Tue, 16 Aug 2016 09:44:00 -0400
changeset 349856 b559173b179738169662cc2203d1831cd7ec9a7b
parent 349855 44330fe94f7b84c08273d659b6a77f408338c9eb
child 349857 e6bbc936ae4ab1c5880c5ea3ad48839c748b5262
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, lizzard
bugs1292522, 409885
milestone50.0a2
Bug 1292522 - Fix regression from bug 409885. r=smaug a=lizzard
dom/html/nsHTMLDocument.cpp
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -942,16 +942,21 @@ nsHTMLDocument::SetDomain(const nsAStrin
   }
 
   rv2 = newURI->SetUserPass(EmptyCString());
   if (NS_FAILED(rv2)) {
     rv.Throw(rv2);
     return;
   }
 
+  // If the old uri had a port number and the new domain does not have,
+  // SetHostPort will not reset the port number of the old uri, it will be
+  // kept. Here we want to reset the port number, so we need to do it manually.
+  newURI->SetPort(-1);
+
   rv2 = newURI->SetHostPort(NS_ConvertUTF16toUTF8(aDomain));
   if (NS_FAILED(rv2)) {
     rv.Throw(rv2);
     return;
   }
 
   // Check new domain - must be a superdomain of the current host
   // For example, a page from foo.bar.com may set domain to bar.com,