diff --git a/repo/resources/Resources.php b/repo/resources/Resources.php
index e10a855135f..2d0c671cfc2 100644
--- a/repo/resources/Resources.php
+++ b/repo/resources/Resources.php
@@ -140,7 +140,7 @@
],
'dependencies' => [
'wikibase',
- 'mediawiki.Uri',
+ 'web2017-polyfills',
],
],
@@ -235,7 +235,6 @@
'mediawiki.api',
'mediawiki.cookie',
'mediawiki.page.watch.ajax',
- 'mediawiki.Uri',
'mediawiki.user',
'mw.config.values.wbRepo',
'mw.config.values.wbDataTypes',
diff --git a/repo/resources/wikibase.entityPage.entityLoaded.js b/repo/resources/wikibase.entityPage.entityLoaded.js
index f073891ed78..bf321a06544 100644
--- a/repo/resources/wikibase.entityPage.entityLoaded.js
+++ b/repo/resources/wikibase.entityPage.entityLoaded.js
@@ -18,20 +18,20 @@
* } );
*
* @example
Convert to jQuery promise
- * var entityPromise = $.Deferred( function ( deferred ) {
+ * const entityPromise = $.Deferred( function ( deferred ) {
* mw.hook( 'wikibase.entityPage.entityLoaded' ).add( function ( entity ) {
* deferred.resolve( entity );
* } );
* } ).promise();
*
* @example Convert to native promise
- * var entityPromise = new Promise( function ( resolve ) {
+ * const entityPromise = new Promise( function ( resolve ) {
* mw.hook( 'wikibase.entityPage.entityLoaded' ).add( function ( entity ) {
* resolve( entity );
* } );
* } );
*/
-( function ( mwConfig, mwUri ) {
+( function ( mwConfig ) {
'use strict';
/**
@@ -42,11 +42,11 @@
*/
function deepFreeze( obj ) {
// Retrieve the property names defined on obj
- var propNames = Object.getOwnPropertyNames( obj );
+ const propNames = Object.getOwnPropertyNames( obj );
// Freeze properties before freezing self
propNames.forEach( function ( name ) {
- var prop = obj[ name ];
+ const prop = obj[ name ];
// Freeze prop if it is an object
if ( typeof prop === 'object' && prop !== null ) {
@@ -58,9 +58,7 @@
return Object.freeze( obj );
}
- var entityId = mwConfig.get( 'wbEntityId' ),
- url,
- specialEntityDataPath;
+ const entityId = mwConfig.get( 'wbEntityId' );
if ( entityId === null ) {
mw.log.error(
@@ -71,19 +69,18 @@
}
// Load from Special:EntityData because it gets cached in several layers
- specialEntityDataPath = mwConfig.get( 'wgArticlePath' ).replace(
+ const specialEntityDataPath = mwConfig.get( 'wgArticlePath' ).replace(
/\$1/g, 'Special:EntityData/' + entityId + '.json'
);
- url = new mwUri( specialEntityDataPath );
- url.extend( { revision: mwConfig.get( 'wgRevisionId' ) } );
-
- $.getJSON( url.toString(), function ( data ) {
- var wbEntity;
+ const url = new URL( specialEntityDataPath, location.href );
+ url.searchParams.set( 'revision', mwConfig.get( 'wgRevisionId' ) );
+ $.getJSON( url.toString(), ( data ) => {
if ( !data || !data.entities || !data.entities[ entityId ] ) {
return;
}
- wbEntity = data.entities[ entityId ];
+
+ const wbEntity = data.entities[ entityId ];
if ( wbEntity ) {
// Note this assumes "wbEntity" contains valid JSON, and will throw an error otherwise.
@@ -91,4 +88,4 @@
}
} );
-}( mw.config, mw.Uri ) );
+}( mw.config ) );