Last modified: 2014-08-28 23:40:11 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T27572, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 25572 - ResourceLoader: Handle bad file paths more elegantly
ResourceLoader: Handle bad file paths more elegantly
Status: RESOLVED WORKSFORME
Product: MediaWiki
Classification: Unclassified
ResourceLoader (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-10-18 22:56 UTC by Michael Dale
Modified: 2014-08-28 23:40 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Michael Dale 2010-10-18 22:56:58 UTC
When you pass in a non-valid file path to the ResourceLoaderFileModule, The resource loader should send an error to the client in the payload or check these paths at the point in which the path is registered and throw an exception at page render time. 

The result of such missing files or error output should not be cached ( even if debug is off )
Comment 1 Trevor Parscal 2010-10-19 00:15:43 UTC
And lets not solve this by adding 1 stat call per file... :)
Comment 2 Roan Kattouw 2010-10-19 16:21:09 UTC
(In reply to comment #1)
> And lets not solve this by adding 1 stat call per file... :)
Did you know PHP (supposedly) has a stat cache causing it to not stat the same file twice during one request?
Comment 3 Trevor Parscal 2010-10-19 16:57:23 UTC
Then by all means, lets solve this by adding 1 stat call (file_exists) per file :)
Comment 4 Michael Dale 2010-10-19 17:24:18 UTC
Right but you probably don't want to stat all resources in every request. Just run the stat call once responding to a resource loader request for the requested resources ( ie right before you read the file, where it will subsequently run stat anyway  ) 

You should add some basic way to have resource loader response to pass down errors or exceptions to javascript. ( ie when outputting a script response and you have an error or exception you should represent that. I previously wrapped errors and used a console.log call, rather than the php html errors that break the javascript processing ) 

This way if one file is missing the error hits the console but the rest of the javascript does not break. 

Furthermore you should treat "error" responses as if "debug" was on. So that the response is not cached.
Comment 5 Krinkle 2011-06-06 09:42:23 UTC
*bump*

Should this be fixed before the release of 1.17.0  / Completion of ResourceLoader 1.0 ?
Comment 6 Roan Kattouw 2011-06-06 09:46:39 UTC
(In reply to comment #5)
> *bump*
> 
> Should this be fixed before the release of 1.17.0  / Completion of
> ResourceLoader 1.0 ?
Meh, it's a nice-to-have IMO.
Comment 7 Bugmeister Bot 2011-08-19 19:12:54 UTC
Unassigning default assignments. http://article.gmane.org/gmane.science.linguistics.wikipedia.technical/54734
Comment 8 Krinkle 2014-08-28 23:40:03 UTC
A regular non-load.php request no longer cascades into module contents as far as I know. I don't think it ever did, but perhaps it did (based on reading this bug).

Either way, it doesn't now. When a module contains references to inexistent files, it s gracefully detected by the startup module (so the other modules load file), a message is logged to the resourceloader log (server-side) and an exception is logged in a js comment atop the startup module request.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links