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
Change Ie065c7b5 added an option to show profiling data at the bottom of
preview pages, and with it new hooks to gather and format this data in a
more structured way than is possible with ParserLimitReport. This change
adds support for the new hooks.
Depends-On: I7799616a602d90e1b8d3f0ece35811ca387bade7
Change-Id: Idffd2d78f9a0217c99c07cbbfc844d6daf0172f7
Change I15c10379 wrapped the scribunto-doc-page-show message in a div,
which is breaking things when the content of that message starts with
start-of-line-sensitive wikitext. So add a newline inside the div.
Bug: 60664
Change-Id: If596bed72f779f5980348ac111b63e7876d21ff4
Message formats other than plain should have never been exposed in this
way, as they allow link tables, etc. to be bypassed and serve no useful
purpose. This removes them, and also removes title, as it serves no
purpose without them.
Bug: 60758
Change-Id: I96284ffbe986a9cd92d2bde1ffdb746029bad989
If we don't do this, then the section edit links point to the wrong page
if we expand a template that contains section headings.
Bug: 55525
Change-Id: I00bda935be3e8b9c0f86fd0f131814207fbb34a7
Include a protectionLevels variable in the output of the mw.title.*
functions, containing the contents of the title's mRestrictions
array (i.e., its protection levels)
Change-Id: I79c9fed64bacfc90aee1d411a3e1b47e44c99755
PHP can't handle having arrays/objects or functions as keys in its
arrays, so make sure we don't try to pass them from Lua. Booleans aren't
really well-handled either, so let's disallow them too.
Also, add tests for proper stringification of floats and infinities when
those are used as keys.
Note this behavior change is needed to match the change in LuaSandbox
for fixing bug 54527, but isn't itself a security issue.
Change-Id: I1e2951bbe8cb78358650ad377bf7119fcac4485d
A module for building complex HTML from Lua using a
fluent interface. The module is originally from enwiki,
but the authors allowed us to reuse it under GPLv2+
(as stated in the file).
The module will be loaded per default and comes with
unit tests.
As discussed on wikitech-l:
http://lists.wikimedia.org/pipermail/wikitech-l/2013-December/073320.html
Change-Id: I7c8d4378091c13d5ace0dd1fcbb4e27163e8c896
Coding style:
* Avoid meaningless '_' in variable names, especially when used
inconsistently.
* Avoid trailing line comments.
* Consistent if/else curly brace position.
* Consistently use single quotes (there are no magic quotes in js).
* Consistently use $ in variable names of jQuery-wrapped elements
(as opposed to plain node references).
* Avoid using variable names like '_this' or 'that', instead name
them after the object.
* Too many var statements.
* Hoist var statement.
* Fix alignment of closing parentheses in initEditPage.
Code quality:
* Remove commented out code.
* Add missing radix parameter for parseInt.
* Remove unused private function "printWithRunin".
* Remove unused parameters.
* Don't call "console.log" in production client-side code because
the console doesn't always exist in normal browser modes (and
would result in an Uncaught ReferenceError, aborting the script
unexpectedly and leaving the user interface in a likely
unresponsive state).
* Use the Promise.done and Promise.fail handlers of mw.Api,
instead of the deprecated 'ok' and 'err' parameters.
* Use jQuery#on instead of the deprecated jQuery#bind.
* Use a local shared reference to the singleton instead of relying
on 'this' context, this way the methods can be called
regardless of context. Such as in the $(document).ready(), or
when passing around setErrors callback.
* Avoid using invalid html shortcuts like <div/>, use <tag>
for creation, and <tag>..</tag> for parsing (per style guide).
* Document inputKeydown parameter being jQuery.Event (as oppposed
to native Event).
Misc:
* Renamed '_in' to 'in', and renamed again to 'input' ('in' is an
illegal variable name and would've crashed).
Change-Id: I283fda1409b1e76db56a939183bdaefc95e60961