jenkins-bot has submitted this change and it was merged. Change subject: mw.UploadWizardLicenseInput: Correct unguarded for...in ......................................................................
mw.UploadWizardLicenseInput: Correct unguarded for...in A for...in loop will also interate over the properties of the prototype of the object. If some other script adds custom properties to Array.prototype or Object.prototype, we'll find them here, `template[ '*' ]` will most likely be undefined and result in an exception from mw.Title. Instead, use a regular for loop. (Wrapping the body of the loop in a hasOwnProperty() check would also work, but since we're iterating over an array, this is nicer.) Bug: T151220 Change-Id: I273b2921f7171754fe9ffac6a84cae7a3d10c05a --- M resources/mw.UploadWizardLicenseInput.js 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: MarkTraceur: Looks good to me, approved jenkins-bot: Verified diff --git a/resources/mw.UploadWizardLicenseInput.js b/resources/mw.UploadWizardLicenseInput.js index de7942d..057c0f1 100644 --- a/resources/mw.UploadWizardLicenseInput.js +++ b/resources/mw.UploadWizardLicenseInput.js @@ -530,7 +530,7 @@ var templates = [], template, title, i; - for ( i in result.parse.templates ) { + for ( i = 0; i < result.parse.templates.length; i++ ) { template = result.parse.templates[ i ]; // normalize templates to mw.Title.getPrefixedDb() format -- To view, visit https://gerrit.wikimedia.org/r/322709 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I273b2921f7171754fe9ffac6a84cae7a3d10c05a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/UploadWizard Gerrit-Branch: master Gerrit-Owner: Bartosz DziewoĆski <matma....@gmail.com> Gerrit-Reviewer: MarkTraceur <mholmqu...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits