When displaying a nosuchfunction or nosuchmodule error, include the name
of the nonexistent function or module.
Change-Id: I17fc2c68dc8267302a82eee3cb2c5df9b5a3c46c
This commit fixes an error with using a mw.title object referring to a
mainspace page as the title argument to frame:expandTemplate(), by
adding a leading colon to prevent the function from searching in the
Template namespace.
Bug: 47601
Change-Id: I4cdc05571598bf7998f4cf0f2691bf86188c3c5d
It's possible to pass information between multiple #invokes on a page by
having the first call math.randomseed with one of a set of known seeds
and then having the second examine the output from math.random to
determine which of those known seeds was used.
Prevent that by calling math.randomseed( 1 ) when invoking (see the bug
for details on why that seed). But avoid doing so if e.g. a
frame:expandTemplate() call results in a recursive invoke.
Bug: 62291
Change-Id: Id01cb63eca52ced29bf4efebc38beb9f159b7b0e
Remove the 6000 character per page limit of mw.language:formatDate(). It
only exists because ParserFunctions has something like it for performance
reasons. Since Lua has a maximum execution time, there's no reason that it
needs this as well.
Change-Id: I42ae4f51295135007c6e2edc66ec36b7d96e3be3
This module doesn't exist on mobile, so don't try to load it there
(which will produce an exception).
Bug: 59808
Change-Id: Ifad7edb508c1f740a109e8f5c1656e4c7841ab13
Since the code related to titles in messages was removed from
mw.message.lua, remove it from here as well. Titles have no effect since
only the plain format is available.
Change-Id: I0c96a4e831abe61100b48cb6a898ad8dbffd8a72
Include the text of the title being complained about when returning an
invalid title error from expandTemplate.
Change-Id: I2261f9574557c3ae514c39cea71f9777f8f9f431
Various methods are throwing exceptions when passed invalid language
codes. Those need to be caught.
And we should really add unit tests for the mw.language library, too.
Doing so exposed another bug (in lang:gender), which is also fixed here.
Bug: 62242
Change-Id: Ib7d257cbb1ce179c510273526910d6ac5f3cac5d
The LuaStandalone interpreter needs to keep a mapping from integers
returned to PHP to the corresponding function. But if it never releases
these functions when PHP no longer has any reference to them, it can
result in Lua running out of memory if a module with a large number of
functions is invoked many times in one page.
The fix here is to track which function ids are referenced from PHP, and
periodically send the list to Lua so it can remove any that are no
longer used from its cache.
This also takes care of another issue where having multiple interpreter
instances and passing function objects from one into another could call
the wrong function in Lua.
Bug: 51886
Change-Id: I4f15841051f7748d1d6df24080949e5cbd88f217