Krinkle has uploaded a new change for review. https://gerrit.wikimedia.org/r/174324
Change subject: Consistently use location as global, and location.href for full url ...................................................................... Consistently use location as global, and location.href for full url The location object is a global, just like document. Using it via 'window' needlessly adds complexity and, for example, makes it harder to catch typos in static analysis. Standardise on location.href in place of the many different variants for accessing and assinging the full url: location = location.href = location.assign() = And each with 'window', 'document' and without host object. Change-Id: If88515bd88fc5b93ebacd4ec41fce02fec540f18 --- M modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js 1 file changed, 6 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/24/174324/1 diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js index ea28a58..af6dcb8 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js @@ -18,8 +18,8 @@ ve.init.mw.ViewPageTarget = function VeInitMwViewPageTarget() { var prefName, prefValue, - //A workaround, as default URI does not get updated after pushState (bug 72334) - currentUri = new mw.Uri( document.location.href ), + // A workaround, as default URI does not get updated after pushState (bug 72334) + currentUri = new mw.Uri( location.href ), conf = mw.config.get( 'wgVisualEditorConfig' ); // Parent constructor @@ -377,7 +377,7 @@ delete this.currentUri.query.veaction; } this.currentUri.query.action = 'edit'; - window.location.href = this.currentUri.toString(); + location.href = this.currentUri.toString(); } else { this.activating = false; // User interface changes @@ -452,7 +452,7 @@ if ( isRedirect ) { newUrlParams.redirect = 'no'; } - window.location.href = this.viewUri.extend( newUrlParams ); + location.href = this.viewUri.extend( newUrlParams ); } else { // Update watch link to match 'watch checkbox' in save dialog. // User logged in if module loaded. @@ -1510,7 +1510,7 @@ return; } - newUri = this.currentUri = new mw.Uri( document.location.href ); + newUri = this.currentUri = new mw.Uri( location.href ); if ( !this.active && newUri.query.veaction === 'edit' ) { this.actFromPopState = true; @@ -1742,7 +1742,7 @@ ve.init.mw.ViewPageTarget.prototype.switchToWikitextEditor = function ( discardChanges ) { if ( discardChanges ) { this.submitting = true; - window.location.href = this.viewUri.clone().extend( { + location.href = this.viewUri.clone().extend( { action: 'edit', veswitched: 1 } ).toString(); -- To view, visit https://gerrit.wikimedia.org/r/174324 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If88515bd88fc5b93ebacd4ec41fce02fec540f18 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Krinkle <krinklem...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits