Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -2575,7 +2575,9 @@ |
2576 | 2576 | continue; |
2577 | 2577 | } |
2578 | 2578 | |
2579 | | - // Support inlining of private modules if configured as such |
| 2579 | + // Support inlining of private modules if configured as such. Note that these |
| 2580 | + // modules should be loaded from getHeadScripts() before the first loader call. |
| 2581 | + // Otherwise other modules can't properly use them as dependencies (bug 30914) |
2580 | 2582 | if ( $group === 'private' && $wgResourceLoaderInlinePrivateModules ) { |
2581 | 2583 | if ( $ ResourceLoaderModule::TYPE_STYLES ) { |
2582 | 2584 | $links .= Html::inlineStyle( |
— | — | @@ -2661,6 +2663,10 @@ |
2662 | 2664 | ) |
2663 | 2665 | ); |
2664 | 2666 | |
| 2667 | + // Load embeddable private modules before any loader links |
| 2668 | + $embedScripts = array( 'user.options', 'user.tokens' ); |
| 2669 | + $scripts .= $this->makeResourceLoaderLink( $embedScripts, ResourceLoaderModule::TYPE_COMBINED ); |
| 2670 | + |
2665 | 2671 | // Script and Messages "only" requests marked for top inclusion |
2666 | 2672 | // Messages should go first |
2667 | 2673 | $scripts .= $this->makeResourceLoaderLink( $this->getModuleMessages( true, 'top' ), ResourceLoaderModule::TYPE_MESSAGES ); |
— | — | @@ -2708,7 +2714,7 @@ |
2709 | 2715 | // Legacy Scripts |
2710 | 2716 | $scripts .= "\n" . $this->mScripts; |
2711 | 2717 | |
2712 | | - $userScripts = array( 'user.options', 'user.tokens' ); |
| 2718 | + $userScripts = array(); |
2713 | 2719 | |
2714 | 2720 | // Add site JS if enabled |
2715 | 2721 | if ( $wgUseSiteJs ) { |
Index: trunk/phase3/includes/resourceloader/ResourceLoader.php |
— | — | @@ -913,8 +913,7 @@ |
914 | 914 | * @return string |
915 | 915 | */ |
916 | 916 | public static function makeLoaderConditionalScript( $script ) { |
917 | | - $script = str_replace( "\n", "\n\t", trim( $script ) ); |
918 | | - return "if(window.mw){\n\t$script\n}\n"; |
| 917 | + return "if(window.mw){\n".trim( $script )."\n}"; |
919 | 918 | } |
920 | 919 | |
921 | 920 | /** |
Index: trunk/phase3/RELEASE-NOTES-1.19 |
— | — | @@ -197,6 +197,8 @@ |
198 | 198 | * (bug 30711) When adding a new section to a page with section=new, the text is |
199 | 199 | now always added to the current version of the page |
200 | 200 | * (bug 31719) Recognize &ns_svg; as the svg namespace when extracting width |
| 201 | +* (bug 30914) Embeddable ResourceLoader modules (user.options, user.tokens) |
| 202 | + should be loaded in <head> for proper dependency resolution |
201 | 203 | |
202 | 204 | === API changes in 1.19 === |
203 | 205 | * (bug 19838) siprop=interwikimap can now use the interwiki cache. |