Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/160251

Change subject: ResourceLoaderWikiModule: Check content format instead of 
content model
......................................................................

ResourceLoaderWikiModule: Check content format instead of content model

For Gadgets 2.0, we have custom content models that represent
JavaScript and CSS pages. Comparing the exact content model here
is too strict, when we really want to know if the page supports
the JavaScript or CSS formats.

Also fix a debug log comment that didn't work due to improper quoting.

Change-Id: I64e86c74173b1c88cac71483327cacdd8b9967b9
---
M includes/resourceloader/ResourceLoaderWikiModule.php
1 file changed, 6 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/51/160251/1

diff --git a/includes/resourceloader/ResourceLoaderWikiModule.php 
b/includes/resourceloader/ResourceLoaderWikiModule.php
index d45316f..5aacba8 100644
--- a/includes/resourceloader/ResourceLoaderWikiModule.php
+++ b/includes/resourceloader/ResourceLoaderWikiModule.php
@@ -96,14 +96,14 @@
                        return null;
                }
 
-               $model = $content->getModel();
-
-               if ( $model !== CONTENT_MODEL_CSS && $model !== 
CONTENT_MODEL_JAVASCRIPT ) {
-                       wfDebugLog( 'resourceloader', __METHOD__ . ': bad 
content model $model for JS/CSS page!' );
+               if ( $content->isSupportedFormat( CONTENT_FORMAT_JAVASCRIPT ) ) 
{
+                       return $content->serialize( CONTENT_FORMAT_JAVASCRIPT );
+               } elseif( $content->isSupportedFormat( CONTENT_FORMAT_CSS ) ) {
+                       return $content->serialize( CONTENT_FORMAT_CSS );
+               } else {
+                       wfDebugLog( 'resourceloader', __METHOD__ . ": bad 
content model {$content->getModel()} for JS/CSS page!" );
                        return null;
                }
-
-               return $content->getNativeData(); //NOTE: this is safe, we know 
it's JS or CSS
        }
 
        /* Methods */

-- 
To view, visit https://gerrit.wikimedia.org/r/160251
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I64e86c74173b1c88cac71483327cacdd8b9967b9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to