Thiemo Mättig (WMDE) has uploaded a new change for review. https://gerrit.wikimedia.org/r/291709
Change subject: Fix getLocationAgnosticMwApi behavior in Internet Explorer ...................................................................... Fix getLocationAgnosticMwApi behavior in Internet Explorer * The apiEndpoint gets initialized as: "https://www.wikidata.org/w/api.php". That's expected. The "s" should be mentioned explicitely. * The local counterpart is initialized as: "//www.wikidata.org/w/api.php". That's also expected and not wrong. What happens is that IE returns "www.wikidata.org:443" for the first but "www.wikidata.org" for the second. This is not the same (but should). Bug: T136543 Change-Id: I329768d5c309f56b5eaadffd03339f2c0b03f21d --- M src/getLocationAgnosticMwApi.js 1 file changed, 6 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseJavaScriptApi refs/changes/09/291709/1 diff --git a/src/getLocationAgnosticMwApi.js b/src/getLocationAgnosticMwApi.js index c9fd7ef..cb36182 100644 --- a/src/getLocationAgnosticMwApi.js +++ b/src/getLocationAgnosticMwApi.js @@ -8,6 +8,11 @@ * @return {string} */ function getHost( url ) { + // Internet Explorer returns an incomplete host (without port) when the protocol is missing. + if ( /^\/\//.test( url ) ) { + url = location.protocol + url; + } + var parser = document.createElement( 'A' ); parser.href = url; return parser.host; @@ -26,11 +31,7 @@ * @return {mediaWiki.Api} */ wb.api.getLocationAgnosticMwApi = function( apiEndpoint ) { - var localApiEndpoint = mw.config.get( 'wgServer' ) - + mw.config.get( 'wgScriptPath' ) - + '/api.php'; - - if ( getHost( localApiEndpoint ) !== getHost( apiEndpoint ) ) { + if ( getHost( apiEndpoint ) !== getHost( mw.config.get( 'wgServer' ) ) ) { // Use mw.ForeignApi if the api we want to use is on a different domain. return new mw.ForeignApi( apiEndpoint ); } -- To view, visit https://gerrit.wikimedia.org/r/291709 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I329768d5c309f56b5eaadffd03339f2c0b03f21d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseJavaScriptApi Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
