diff options
author | Roan Kattouw <roan.kattouw@gmail.com> | 2024-03-01 12:59:09 -0800 |
---|---|---|
committer | Roan Kattouw <roan.kattouw@gmail.com> | 2024-03-01 12:59:09 -0800 |
commit | 166d40102bd266c5817b99b16ce8bf2336ff5814 (patch) | |
tree | f23c7c74fed6b26bc1aa1b0fe595bff95d059a53 /includes/ResourceLoader/CodexModule.php | |
parent | 46e64513bb6643101367e3c9821cab75c46c0a05 (diff) | |
download | mediawikicore-166d40102bd266c5817b99b16ce8bf2336ff5814.tar.gz mediawikicore-166d40102bd266c5817b99b16ce8bf2336ff5814.zip |
CodexModule: Explicitly disable URL loading
FileModule::supportsURLLoading() looks like it should return false for
CodexModules since they have packageFiles, but it runs before we can add
things to $this->packageFiles (at least for modules without packageFiles
of their own, like @wikimedia/codex-search). We can't call setupCodex()
and then call the parent method like we do for other overridden methods,
because we don't get a Context object, so just always disable URL
loading.
Not doing this led to a bug where the output of the
@wikimedia/codex-search module was empty when ?debug=1 was passed,
because we erroneously marked that module as supporting URL loading when
in reality it contained package files.
Bug: T358903
Change-Id: I7b87f78ed901b79236c8280a08bb73ac813926c7
Diffstat (limited to 'includes/ResourceLoader/CodexModule.php')
-rw-r--r-- | includes/ResourceLoader/CodexModule.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/includes/ResourceLoader/CodexModule.php b/includes/ResourceLoader/CodexModule.php index b9935f581c84..3f72f5241514 100644 --- a/includes/ResourceLoader/CodexModule.php +++ b/includes/ResourceLoader/CodexModule.php @@ -192,6 +192,15 @@ class CodexModule extends FileModule { return false; } + public function supportsURLLoading() { + // We need to override this explicitly. The parent method might return true if there are + // no 'packageFiles' set in the module definition and they're all generated by us. + // It's possible that this "should" return true in some circumstances (e.g. style-only use + // of CodexModule combined with non-packageFiles scripts), but those are edge cases that + // we're choosing not to support here. + return false; + } + /** * Get the theme to use based on the current skin. * |