Move wgBreakFrames client code to mediawiki.page.startup
authorTimo Tijhof <krinklemail@gmail.com>
Fri, 30 Jun 2017 20:36:54 +0000 (13:36 -0700)
committerKrinkle <krinklemail@gmail.com>
Fri, 30 Jun 2017 20:40:18 +0000 (20:40 +0000)
Follows-up f7c324685195, which migrated this from legacy wikibits
to the 'mediawiki.page.ready', however it's better suited in
'mediawiki.page.startup' because that one loaded on all pages blindly
(used to be hardcoded in OutputPage, now part of 'core' group
in Skin::getDefaultModules).

mediawiki.page.ready on the other hand is primarily for enhancing
the page content, loaded in Skin::getDefaultModules in the 'content'
group, which extensions like MobileFrontend may override with an
alternate implementation. This means frame breaking is bypassed!

Change-Id: Ia7206fac5c4ec6ace87304cfaeef375916b94fcf

resources/src/mediawiki/page/ready.js
resources/src/mediawiki/page/startup.js

index 1f6c8a6..e147664 100644 (file)
@@ -1,14 +1,4 @@
 ( function ( mw, $ ) {
-       // Break out of framesets
-       if ( mw.config.get( 'wgBreakFrames' ) ) {
-               // Note: In IE < 9 strict comparison to window is non-standard (the standard didn't exist yet)
-               // it works only comparing to window.self or window.window (http://stackoverflow.com/q/4850978/319266)
-               if ( window.top !== window.self ) {
-                       // Un-trap us from framesets
-                       window.top.location.href = location.href;
-               }
-       }
-
        mw.hook( 'wikipage.content' ).add( function ( $content ) {
                var $sortable, $collapsible;
 
index 49cfd8a..7514044 100644 (file)
@@ -1,4 +1,13 @@
 ( function ( mw, $ ) {
+       // Break out of framesets
+       if ( mw.config.get( 'wgBreakFrames' ) ) {
+               // Note: In IE < 9 strict comparison to window is non-standard (the standard didn't exist yet)
+               // it works only comparing to window.self or window.window (http://stackoverflow.com/q/4850978/319266)
+               if ( window.top !== window.self ) {
+                       // Un-trap us from framesets
+                       window.top.location.href = location.href;
+               }
+       }
 
        $( function () {
                var $diff;