merged master
[lhc/web/wiklou.git] / includes / resourceloader / ResourceLoaderWikiModule.php
index a69676d..30d706c 100644 (file)
@@ -22,8 +22,6 @@
  * @author Roan Kattouw
  */
 
-defined( 'MEDIAWIKI' ) || die( 1 );
-
 /**
  * Abstraction for resource loader modules which pull from wiki pages
  *
@@ -44,7 +42,6 @@ abstract class ResourceLoaderWikiModule extends ResourceLoaderModule {
        /* Abstract Protected Methods */
 
        /**
-        * @abstract
         * @param $context ResourceLoaderContext
         */
        abstract protected function getPages( ResourceLoaderContext $context );
@@ -84,7 +81,16 @@ abstract class ResourceLoaderWikiModule extends ResourceLoaderModule {
                if ( !$revision ) {
                        return null;
                }
-               return $revision->getRawText();
+
+               $content = $revision->getContent( Revision::RAW );
+               $model = $content->getModel();
+
+               if ( $model !== CONTENT_MODEL_CSS && $model !== CONTENT_MODEL_JAVASCRIPT ) {
+                       wfDebug( __METHOD__ . "bad content model #$model for JS/CSS page!\n" );
+                       return null;
+               }
+
+               return $content->getNativeData(); //NOTE: this is safe, we know it's JS or CSS
        }
 
        /* Methods */