From: Roan Kattouw Date: Sun, 15 Nov 2015 01:28:25 +0000 (-0800) Subject: Don't "preview" (i.e. execute) user JS on non-preview requests X-Git-Tag: 1.31.0-rc.0~8923^2 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=710b532d5a3691f8fd13157a08277aa2a3753a06;p=lhc%2Fweb%2Fwiklou.git Don't "preview" (i.e. execute) user JS on non-preview requests If you edit your user JS page, change the JS, and click Show preview, the new JS will be loaded ("previewed"). However, this "preview" is also engaged when you click Show changes, or click "Save page" and fail to save. Don't do that: only "preview" JS when the user has actually chosen to preview it. Change-Id: Id9bcd235d3414b68de6e5d491b7b0c4f9b16e05f --- diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 81724c5cd8..c35204d604 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -3309,7 +3309,11 @@ class OutputPage extends ContextSource { */ public function userCanPreview() { $request = $this->getRequest(); - if ( $request->getVal( 'action' ) !== 'submit' || !$request->wasPosted() ) { + if ( + $request->getVal( 'action' ) !== 'submit' || + !$request->getCheck( 'wpPreview' ) || + !$request->wasPosted() + ) { return false; }