From 9ef039dd4b24e1b9d41a4628e75607dbef930d9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Wed, 4 Jul 2018 00:09:36 +0200 Subject: [PATCH] DesktopArticleTarget.init: Fix URI comparison if it contains a port number If the wiki runs on a host that contains a port number, section edit links would always reload the page, and the "Add section" tab would not work. As it happens, my local testing wiki runs on localhost:3080. It is an unfortunate naming mishap: * mw.Uri#host is equivalent to location.hostname * mw.Uri#getHostPort is equivalent to location.host In this case, we have to compare the port too, otherwise a setup (my setup ;) ) where one starts up another wiki on localhost:3081 to test cross-wiki features would fail. Change-Id: Ib7de4ba3c3a84888f24186af03bd9dcced131051 --- .../ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js index 1e2978f608..cea43d1887 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js +++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js @@ -896,7 +896,7 @@ // Not an edit action !( 'action' in uri.query || 'veaction' in uri.query ) || // Edit target is on another host (e.g. commons file) - uri.host !== location.host || + uri.getHostPort() !== location.host || // Title param doesn't match current page title && title.getPrefixedText() !== new mw.Title( mw.config.get( 'wgRelevantPageName' ) ).getPrefixedText() ) {