Catrope has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/253152

Change subject: Don't "preview" (i.e. execute) user JS on non-preview requests
......................................................................

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
---
M includes/OutputPage.php
1 file changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/52/253152/1

diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index 81724c5..c35204d 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -3309,7 +3309,11 @@
         */
        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;
                }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/253152
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id9bcd235d3414b68de6e5d491b7b0c4f9b16e05f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to