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 342413 858d5a1cf8956b72c6a120fadddb67dcb853c9e4
parent 342412 e454d5a9aa40c7a9ec8d3c8459592e349406a275
child 342414 7398a1146aa464c4f36caa0d730f3d3c6c21452e
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, lizzard
bugs1292522, 409885
milestone49.0
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,