[MediaWiki-commits] [Gerrit] mediawiki/core[master]: resourceloader: Remove top/bottom queue distinction

2016-11-17 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: resourceloader: Remove top/bottom queue distinction
..


resourceloader: Remove top/bottom queue distinction

* The styles queue has always been top-only
  (except for a few months in 2015).
* The top queue loads asynchronous since mid-2015. (T107399)
  And LocalStorage eval, previously the last remaining non-async part
  of module loading, is also async as of October 2016. (T142129)

* This change merges the bottom 'mw.loader.load()' queue with the top queue.
  It also moves any other snippets potentially in the bottom queue still:
  - embed: I couldn't find any private modules with position=bottom
 (doesn't make sense due to their blocking nature). If any do exist,
 (third-party extensions?), they'll now be embedded in the .
  - scripts: Any legacy 'only=scripts' requests will now initiate
 from the .

Bug: T109837
Change-Id: I6c21e3e47c23df33a04c42ce94bd4c1964599c7f
---
M includes/resourceloader/ResourceLoaderClientHtml.php
M includes/resourceloader/ResourceLoaderModule.php
M tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php
3 files changed, 23 insertions(+), 69 deletions(-)

Approvals:
  Gilles: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/resourceloader/ResourceLoaderClientHtml.php 
b/includes/resourceloader/ResourceLoaderClientHtml.php
index 5729218..91e0b02 100644
--- a/includes/resourceloader/ResourceLoaderClientHtml.php
+++ b/includes/resourceloader/ResourceLoaderClientHtml.php
@@ -130,26 +130,15 @@
'states' => [
// moduleName => state
],
-   'general' => [
-   // position => [ moduleName ]
-   'top' => [],
-   'bottom' => [],
-   ],
+   'general' => [],
'styles' => [
// moduleName
],
-   'scripts' => [
-   // position => [ moduleName ]
-   'top' => [],
-   'bottom' => [],
-   ],
+   'scripts' => [],
// Embedding for private modules
'embed' => [
'styles' => [],
-   'general' => [
-   'top' => [],
-   'bottom' => [],
-   ],
+   'general' => [],
],
 
];
@@ -161,16 +150,15 @@
}
 
$group = $module->getGroup();
-   $position = $module->getPosition();
 
if ( $group === 'private' ) {
// Embed via mw.loader.implement per T36907.
-   $data['embed']['general'][$position][] = $name;
+   $data['embed']['general'][] = $name;
// Avoid duplicate request from mw.loader
$data['states'][$name] = 'loading';
} else {
// Load via mw.loader.load()
-   $data['general'][$position][] = $name;
+   $data['general'][] = $name;
}
}
 
@@ -216,14 +204,13 @@
}
 
$group = $module->getGroup();
-   $position = $module->getPosition();
$context = $this->getContext( $group, 
ResourceLoaderModule::TYPE_SCRIPTS );
if ( $module->isKnownEmpty( $context ) ) {
// Avoid needless request for empty module
$data['states'][$name] = 'ready';
} else {
// Load from load.php?only=scripts via 
-   $data['scripts'][$position][] = $name;
+   $data['scripts'][] = $name;
 
// Avoid duplicate request from mw.loader
$data['states'][$name] = 'loading';
@@ -282,24 +269,24 @@
}
 
// Inline RLQ: Embedded modules
-   if ( $data['embed']['general']['top'] ) {
+   if ( $data['embed']['general'] ) {
$chunks[] = $this->getLoad(
-   $data['embed']['general']['top'],
+   $data['embed']['general'],
ResourceLoaderModule::TYPE_COMBINED

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: resourceloader: Remove top/bottom queue distinction

2016-11-07 Thread Krinkle (Code Review)
Krinkle has uploaded a new change for review.

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

Change subject: resourceloader: Remove top/bottom queue distinction
..

resourceloader: Remove top/bottom queue distinction

* The styles queue has always been top-only
  (except for a few months in 2015).
* The top queue loads asynchronous since mid-2015. (T107399)
  And LocalStorage eval, previously the last remaining non-async part
  of module loading, is also async as of October 2016. (T142129)

* This change merges the bottom 'mw.loader.load()' queue with the top queue.
  It also moves any other snippets potentially in the bottom queue still:
  - embed: I couldn't find any private modules with position=bottom
 (doesn't make sense due to their blocking nature). If any do exist,
 (third-party extensions?), they'll now be embedded in the .
  - scripts: Any legacy 'only=scripts' requests will now initiate
 from the .

Bug: T109837
Change-Id: I6c21e3e47c23df33a04c42ce94bd4c1964599c7f
---
M includes/resourceloader/ResourceLoaderClientHtml.php
M includes/resourceloader/ResourceLoaderModule.php
M tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php
3 files changed, 23 insertions(+), 69 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/15/320315/1

diff --git a/includes/resourceloader/ResourceLoaderClientHtml.php 
b/includes/resourceloader/ResourceLoaderClientHtml.php
index 5729218..91e0b02 100644
--- a/includes/resourceloader/ResourceLoaderClientHtml.php
+++ b/includes/resourceloader/ResourceLoaderClientHtml.php
@@ -130,26 +130,15 @@
'states' => [
// moduleName => state
],
-   'general' => [
-   // position => [ moduleName ]
-   'top' => [],
-   'bottom' => [],
-   ],
+   'general' => [],
'styles' => [
// moduleName
],
-   'scripts' => [
-   // position => [ moduleName ]
-   'top' => [],
-   'bottom' => [],
-   ],
+   'scripts' => [],
// Embedding for private modules
'embed' => [
'styles' => [],
-   'general' => [
-   'top' => [],
-   'bottom' => [],
-   ],
+   'general' => [],
],
 
];
@@ -161,16 +150,15 @@
}
 
$group = $module->getGroup();
-   $position = $module->getPosition();
 
if ( $group === 'private' ) {
// Embed via mw.loader.implement per T36907.
-   $data['embed']['general'][$position][] = $name;
+   $data['embed']['general'][] = $name;
// Avoid duplicate request from mw.loader
$data['states'][$name] = 'loading';
} else {
// Load via mw.loader.load()
-   $data['general'][$position][] = $name;
+   $data['general'][] = $name;
}
}
 
@@ -216,14 +204,13 @@
}
 
$group = $module->getGroup();
-   $position = $module->getPosition();
$context = $this->getContext( $group, 
ResourceLoaderModule::TYPE_SCRIPTS );
if ( $module->isKnownEmpty( $context ) ) {
// Avoid needless request for empty module
$data['states'][$name] = 'ready';
} else {
// Load from load.php?only=scripts via 
-   $data['scripts'][$position][] = $name;
+   $data['scripts'][] = $name;
 
// Avoid duplicate request from mw.loader
$data['states'][$name] = 'loading';
@@ -282,24 +269,24 @@
}
 
// Inline RLQ: Embedded modules
-   if ( $data['embed']['general']['top'] ) {
+   if ( $data['embed']['general'] ) {
$chunks[] = $this->getLoad(
-   $data['embed']['general']['top'],
+   $data['embed']['general'],