r88794 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88793‎ | r88794 | r88795 >
Date:15:19, 25 May 2011
Author:catrope
Status:reverted (Comments)
Tags:
Comment:
Use $.extend() in mw.util and mw.util.jpegmeta so they can be loaded in either order. This means mw.util.jpegmeta doesn't depend on mw.util loading first any more
Modified paths:
  • /trunk/phase3/resources/mediawiki.util/mediawiki.util.jpegmeta.js (modified) (history)
  • /trunk/phase3/resources/mediawiki.util/mediawiki.util.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/mediawiki.util/mediawiki.util.jpegmeta.js
@@ -724,8 +724,10 @@
725725
726726 /* JsJpegMeta ends here */
727727
728 - mw.util.jpegmeta = function( fileReaderResult, fileName ) {
729 - return new JpegMeta.JpegFile( fileReaderResult, fileName );
730 - };
 728+ mw.util = $.extend( mw.util || {}, {
 729+ jpegmeta: function( fileReaderResult, fileName ) {
 730+ return new JpegMeta.JpegFile( fileReaderResult, fileName );
 731+ }
 732+ } );
731733
732734 } )( jQuery, mediaWiki );
\ No newline at end of file
Index: trunk/phase3/resources/mediawiki.util/mediawiki.util.js
@@ -3,7 +3,7 @@
44 */
55 ( function( $, mw ) {
66
7 - mw.util = {
 7+ mw.util = $.extend( mw.util || {}, {
88
99 /* Initialisation */
1010 'initialised' : false,

Follow-up revisions

RevisionCommit summaryAuthorDate
r88796Fix syntax error in r88794catrope15:28, 25 May 2011
r89083Introducing mw.libs, moving JpegMeta into it....krinkle03:13, 29 May 2011

Comments

#Comment by Krinkle (talk | contribs)   19:34, 28 May 2011

The ResourceLoader module never had a dependancy on the mediawiki.util so module, it assumed it was loaded, so that's fixed in this commit.

But on the other hand, this:

  • might brake mediawiki.util.js if loaded asynchronously (could override it if not defined yet but started execution of that file, or is that not possible and am I paranoid here?)
  • jpegmeta perhaps shouldn't extend mediawiki.util at all.
    • or, we define mw.util in mediawiki.js as an empty object (no need for extending that way)
    • or, we define mw.libs in mediawiki.js as an empty object (no need for extending that way)
      • in that case mw.util's definition can co back to an object literal.
#Comment by Krinkle (talk | contribs)   03:14, 29 May 2011

Done the latter in r89083.

Status & tagging log