Commit graph

17 commits

Author SHA1 Message Date
Timo Tijhof
eadbde08c7 ResourceLoader: Bump STORAGE_VERSION
Follow-up to enabling of wgResourceLoaderEnableSourceMapLinks by
default, to ensure local storage rolls over, which prevents cases
where modules that rarely change appear unmapped due to stale
cache entries.

Bug: T47514
Change-Id: I1956fc28a1eece28ca579f853bc1538927b0a497
2023-10-03 10:58:00 -07:00
Timo Tijhof
4eeb38a36a ResourceLoader: Set virtualFilePath for startup.js (take 2)
Source maps are now enabled on www.mediawiki.org, and one of the
things that stands out is the (one) virtual file on every page view
for startup.js.

Previous attempt (93a27630c2, I7017de5757) was reverted due to
blameStartupRegistry.php in WikimediaMaintenance assuming a
string-returning StartupModule::getScript (T346800).
This is fixed in I83879ebcf97695ae16c322.

Bug: T47514
Depends-On: I83879ebcf97695ae16c322f8f8a744c49039fa0e
Change-Id: I6b9b1bfea6d169dd5efbd5ab3b1b33e6b04a42c2
2023-09-19 20:35:58 -07:00
Jforrester
af5cf8f423 Revert "ResourceLoader: Set 'virtualFilePath' for startup.js"
This reverts commit 93a27630c2.

Bug: T346800
Change-Id: I0c124dbf490f4841c02cf98f31daab8c61cb4f78
2023-09-19 18:36:31 +00:00
Timo Tijhof
93a27630c2 ResourceLoader: Set 'virtualFilePath' for startup.js
Source maps are now enabled on www.mediawiki.org, and one of the
things that stands out is the (one) virtual file on every page view
for startup.js.

Bug: T47514
Change-Id: I7017de5757b22263f1076cfdcef0b5c9536dcc6a
2023-09-14 23:44:44 +00:00
Tim Starling
a1b554d876 Implement source map support for localStorage cache hits
Append a source map link to JS code before saving it to localStorage.

Unfortunately the function constructor adds a browser-dependent header
to the buffer which causes the mappings to be offset. So use indirect
eval when executing cached modules.

Bug: T343407
Change-Id: I298e3567c9eb13e7c9c062442289d8d1514a0ab2
2023-08-28 22:29:50 +01:00
Tim Starling
f2a5946375 ResourceLoader: wrap module definitions in functions
This is an intermediate step towards the linked bug, to help untangle
the performance impacts.

Bug: T343407
Change-Id: I086f173f811fb44683f4a67bf6bc415d7e27f593
2023-08-11 00:36:52 +00:00
Jon Robson
be122d4f2a Deprecate use of targets
Bug: T127268
Change-Id: I94db414ba207dab0dd9a4537f643a28ee513ca0e
2023-06-16 15:16:07 -07:00
James D. Forrester
6c7177349b ResourceLoader: Raise MW JavaScript startup requirement to ES6
The UA sniffs that overrode the feature tests are no longer needed.

* MSIE 10: Fine, rejected by feature checks.

* UC Mini "Speed Mode": Redundant, the version that this sniff
  matched is pre-ES6. Current versions of UC Mini don't appear to
  support enabling "Speed Mode" on random websites nor does it offer
  it for Wikipedia specifically.
  Details at https://phabricator.wikimedia.org/T178356#8740573.

* Google Web Light: Redundant, shutdown as of 2022.
  Any references or extensions that still reach the proxy, get
  redirected to our online URLs
  https://googleweblight.com/?lite_url=https://en.m.wikipedia.org/wiki/Banana
  https://phabricator.wikimedia.org/T152602
  https://en.wikipedia.org/wiki/Google_Web_Light

* MeeGo: Redundant, discontinued and presumed rejected.
  Either way, unsupported.

* Opera Mini: Fine, rejected by checks.
  Details at https://phabricator.wikimedia.org/T178356#8740573.

* Ovi Browser: Redundant, discontinued and presumed rejected.
  Either way, unsupported.

* Google Glass: Improve UX (since 2013, T58008).

* NetFront: Redundant. Old versions are presumed rejected.
  Current versions are Chromium-based and presumed fine.
  The exclusion was not UX based, but due to jQuery explicitly not
  supporting it in 2013. This is no longer the case, so we can let
  the feature test lead the way here.

* PlayStation: Redundant, same story as NetFront.
  The version that matched the sniff is presumed rejected.
  Current versions probably fine, but even not, don't match
  our sniff so are already enabled today.

Bug: T178356
Change-Id: Ib6263ce3ffd11af5e501de8857f3e48a248c6210
2023-03-30 14:26:05 +01:00
Kosta Harlan
78916de4aa ResourceLoader: Define targets in a single location
All the *Module classes end up inheriting from ResourceLoader/Module, so
we only need to define the targets there.

Bug: T127268
Bug: T328497
Change-Id: I12b126377cea78b88269e6efe68f92f3586c4ecc
2023-02-02 16:27:08 +00:00
Zabe
f6b9381d7f Revert "Reorg: Move some of request related classes to MediaWiki/Request"
This reverts commit 2bdc0b2b72.

Reason for revert: T166010#8349431

Bug: T166010
Change-Id: Idcd3025647aec99532f5d69b9c1718c531761283
2022-10-27 13:14:16 +00:00
Amir Sarabadani
2bdc0b2b72 Reorg: Move some of request related classes to MediaWiki/Request
Moving:
 - DerivativeRequest
 - FauxRequest
 - FauxRequestUpload
 - PathRouter
 - WebRequest
 - WebRequestUpload

Bug: T166010
Change-Id: I5ea70120d745f2876ae31d039f3f8a51e49e9ad8
2022-10-26 16:49:10 +02:00
Umherirrender
5c5498a202 Remove unused key variable from foreach loops
Change-Id: Id2d91e30a6f7cc4eb93427b50efc1c5c77f14b75
2022-09-21 21:18:43 +02:00
DannyS712
f05145b833 ResourceLoader: improve readability and simplify in StartUpModule
Use early returns to reduce nesting in getImplicitDependencies(),
and unhoist some variables for clarity in getModuleRegistrations().
Should be a no-op in terms of functionality.

Change-Id: Ib999ecceca1f30eb289936ca3ae493e192cd0f43
2022-06-23 03:36:07 +00:00
Timo Tijhof
519e95adc0 resourceloader: Decouple some internal constructor args
Move config defaults to ResourceLoader class, so that the defaults
reside within the component responsibility, and for future standalone
use and unit testing with the same set of defaults.

Bug: T32956
Change-Id: I4a268e11686e526c4377542d45e198a72e57f182
2022-06-02 18:27:33 +01:00
Tim Starling
3e2653f83b ResourceLoader namespace (attempt 2)
Move ResourceLoader classes to their own namespace. Strip the
"ResourceLoader" prefix from all except ResourceLoader itself.

Move the tests by analogy.

I used a namespace alias "RL" in some callers since RL\Module is less
ambiguous at the call site than just "Module".

I did not address DependencyStore which continues to have a non-standard
location and namespace.

Revert of a241d83e0a.

Bug: T308718
Change-Id: Id08a220e1d6085e2b33f3f6c9d0e3935a4204659
2022-05-24 15:41:46 +00:00
Lucas Werkmeister (WMDE)
a241d83e0a Revert "ResourceLoader namespace"
This reverts commit e08ea8ccb9.

Reason for revert: Breaks Phan in extensions, and as far as I’m aware,
this change isn’t urgently needed for anything, so the simplest fix is
to revert it again for now. After PHP 7.4 it should be safer to try this
again (we hopefully won’t need the two “hack” classes by then).

Bug: T308443
Change-Id: Iff3318cbf97a67f821f78e60da62a583f63e389e
2022-05-16 14:43:33 +00:00
Tim Starling
e08ea8ccb9 ResourceLoader namespace
Move ResourceLoader classes to their own namespace. Strip the
"ResourceLoader" prefix from all except ResourceLoader and
ResourceLoaderContext.

Move the tests by analogy.

I used a namespace alias "RL" in some callers since RL\Module is less
ambiguous at the call site than just "Module".

I did not address DependencyStore which continues to have a non-standard
location and namespace.

Change-Id: I92998ae6a82e0b935c13e02a183e7c324fa410a3
2022-05-16 14:41:27 +10:00
Renamed from includes/resourceloader/ResourceLoaderStartUpModule.php (Browse further)